1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.content.browser.accessibility; 6 7 import android.view.accessibility.AccessibilityEvent; 8 import android.view.accessibility.AccessibilityNodeInfo; 9 10 import org.chromium.base.JNINamespace; 11 import org.chromium.content.browser.ContentViewCore; 12 13 /** 14 * Subclass of BrowserAccessibilityManager for KitKat that creates an 15 * AccessibilityNodeProvider and delegates its implementation to this object. 16 * 17 * THIS CLASS IS NOT USED! A bug in the KitKat framework prevents us 18 * from using these new APIs. We can re-enable this class after the next 19 * Android system update. http://crbug.com/348088/ 20 */ 21 @JNINamespace("content") 22 public class KitKatBrowserAccessibilityManager extends JellyBeanBrowserAccessibilityManager { KitKatBrowserAccessibilityManager(long nativeBrowserAccessibilityManagerAndroid, ContentViewCore contentViewCore)23 KitKatBrowserAccessibilityManager(long nativeBrowserAccessibilityManagerAndroid, 24 ContentViewCore contentViewCore) { 25 super(nativeBrowserAccessibilityManagerAndroid, contentViewCore); 26 } 27 28 @Override setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node, boolean canOpenPopup, boolean contentInvalid, boolean dismissable, boolean multiLine, int inputType, int liveRegion)29 protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node, 30 boolean canOpenPopup, 31 boolean contentInvalid, 32 boolean dismissable, 33 boolean multiLine, 34 int inputType, 35 int liveRegion) { 36 node.setCanOpenPopup(canOpenPopup); 37 node.setContentInvalid(contentInvalid); 38 node.setDismissable(contentInvalid); 39 node.setMultiLine(multiLine); 40 node.setInputType(inputType); 41 node.setLiveRegion(liveRegion); 42 } 43 44 @Override setAccessibilityNodeInfoCollectionInfo(AccessibilityNodeInfo node, int rowCount, int columnCount, boolean hierarchical)45 protected void setAccessibilityNodeInfoCollectionInfo(AccessibilityNodeInfo node, 46 int rowCount, int columnCount, boolean hierarchical) { 47 node.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain( 48 rowCount, columnCount, hierarchical)); 49 } 50 51 @Override setAccessibilityNodeInfoCollectionItemInfo(AccessibilityNodeInfo node, int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading)52 protected void setAccessibilityNodeInfoCollectionItemInfo(AccessibilityNodeInfo node, 53 int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading) { 54 node.setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo.obtain( 55 rowIndex, rowSpan, columnIndex, columnSpan, heading)); 56 } 57 58 @Override setAccessibilityNodeInfoRangeInfo(AccessibilityNodeInfo node, int rangeType, float min, float max, float current)59 protected void setAccessibilityNodeInfoRangeInfo(AccessibilityNodeInfo node, 60 int rangeType, float min, float max, float current) { 61 node.setRangeInfo(AccessibilityNodeInfo.RangeInfo.obtain( 62 rangeType, min, max, current)); 63 } 64 65 @Override setAccessibilityEventKitKatAttributes(AccessibilityEvent event, boolean canOpenPopup, boolean contentInvalid, boolean dismissable, boolean multiLine, int inputType, int liveRegion)66 protected void setAccessibilityEventKitKatAttributes(AccessibilityEvent event, 67 boolean canOpenPopup, 68 boolean contentInvalid, 69 boolean dismissable, 70 boolean multiLine, 71 int inputType, 72 int liveRegion) { 73 // This is just a fallback for pre-KitKat systems. 74 // Do nothing on KitKat and higher. 75 } 76 77 @Override setAccessibilityEventCollectionInfo(AccessibilityEvent event, int rowCount, int columnCount, boolean hierarchical)78 protected void setAccessibilityEventCollectionInfo(AccessibilityEvent event, 79 int rowCount, int columnCount, boolean hierarchical) { 80 // This is just a fallback for pre-KitKat systems. 81 // Do nothing on KitKat and higher. 82 } 83 84 @Override setAccessibilityEventHeadingFlag(AccessibilityEvent event, boolean heading)85 protected void setAccessibilityEventHeadingFlag(AccessibilityEvent event, 86 boolean heading) { 87 // This is just a fallback for pre-KitKat systems. 88 // Do nothing on KitKat and higher. 89 } 90 91 @Override setAccessibilityEventCollectionItemInfo(AccessibilityEvent event, int rowIndex, int rowSpan, int columnIndex, int columnSpan)92 protected void setAccessibilityEventCollectionItemInfo(AccessibilityEvent event, 93 int rowIndex, int rowSpan, int columnIndex, int columnSpan) { 94 // This is just a fallback for pre-KitKat systems. 95 // Do nothing on KitKat and higher. 96 } 97 98 @Override setAccessibilityEventRangeInfo(AccessibilityEvent event, int rangeType, float min, float max, float current)99 protected void setAccessibilityEventRangeInfo(AccessibilityEvent event, 100 int rangeType, float min, float max, float current) { 101 // This is just a fallback for pre-KitKat systems. 102 // Do nothing on KitKat and higher. 103 } 104 } 105