Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java |
| index 2180b480e7f46bd10b6e69def1cf7b06a551bf91..9f14032a90b8f5b53666c0b5c42bde9171ef9e55 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java |
| @@ -62,7 +62,10 @@ public class BrowserAccessibilityManager { |
| @CalledByNative |
| private static BrowserAccessibilityManager create(int nativeBrowserAccessibilityManagerAndroid, |
| ContentViewCore contentViewCore) { |
| - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { |
| + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| + return new KitKatBrowserAccessibilityManager( |
| + nativeBrowserAccessibilityManagerAndroid, contentViewCore); |
| + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { |
| return new JellyBeanBrowserAccessibilityManager( |
| nativeBrowserAccessibilityManagerAndroid, contentViewCore); |
| } else { |
| @@ -241,6 +244,15 @@ public class BrowserAccessibilityManager { |
| mContentViewCore.getContainerView().requestSendAccessibilityEvent(mView, event); |
| } |
| + private Bundle getOrCreateBundleForAccessibilityEvent(AccessibilityEvent event) { |
| + Bundle bundle = (Bundle)event.getParcelableData(); |
| + if (bundle == null) { |
| + bundle = new Bundle(); |
| + event.setParcelableData(bundle); |
| + } |
| + return bundle; |
| + } |
| + |
| @CalledByNative |
| private void handlePageLoaded(int id) { |
| if (mUserHasTouchExplored) return; |
| @@ -396,6 +408,35 @@ public class BrowserAccessibilityManager { |
| } |
| @CalledByNative |
| + protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node, |
| + boolean canOpenPopup, |
| + boolean contentInvalid, |
| + boolean dismissable, |
| + boolean multiLine, |
| + int inputType, |
| + int liveRegion) { |
| + // Requires KitKat or higher. |
| + } |
| + |
| + @CalledByNative |
| + protected void setAccessibilityNodeInfoCollectionInfo(AccessibilityNodeInfo node, |
| + int rowCount, int columnCount, boolean hierarchical) { |
| + // Requires KitKat or higher. |
| + } |
| + |
| + @CalledByNative |
| + protected void setAccessibilityNodeInfoCollectionItemInfo(AccessibilityNodeInfo node, |
| + int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading) { |
| + // Requires KitKat or higher. |
| + } |
| + |
| + @CalledByNative |
| + protected void setAccessibilityNodeInfoRangeInfo(AccessibilityNodeInfo node, |
| + int rangeType, float min, float max, float current) { |
| + // Requires KitKat or higher. |
| + } |
| + |
| + @CalledByNative |
| private void setAccessibilityEventBooleanAttributes(AccessibilityEvent event, |
| boolean checked, boolean enabled, boolean password, boolean scrollable) { |
| event.setChecked(checked); |
| @@ -444,6 +485,53 @@ public class BrowserAccessibilityManager { |
| event.getText().add(text); |
| } |
| + @CalledByNative |
| + protected void setAccessibilityEventKitKatAttributes(AccessibilityEvent event, |
| + boolean canOpenPopup, |
| + boolean contentInvalid, |
| + boolean dismissable, |
| + boolean multiLine, |
| + int inputType, |
| + int liveRegion) { |
| + Bundle bundle = getOrCreateBundleForAccessibilityEvent(event); |
| + bundle.putBoolean("canOpenPopup", canOpenPopup); |
|
Peter Lundblad
2013/11/19 18:40:53
Since we are not doing any namespacing here, do we
|
| + bundle.putBoolean("contentInvalid", contentInvalid); |
| + bundle.putBoolean("dismissable", dismissable); |
| + bundle.putBoolean("multiLine", multiLine); |
| + bundle.putInt("inputType", inputType); |
| + bundle.putInt("liveRegion", liveRegion); |
| + } |
| + |
| + @CalledByNative |
| + protected void setAccessibilityEventCollectionInfo(AccessibilityEvent event, |
| + int rowCount, int columnCount, boolean hierarchical) { |
| + Bundle bundle = getOrCreateBundleForAccessibilityEvent(event); |
| + bundle.putInt("CollectionInfo.rowCount", rowCount); |
| + bundle.putInt("CollectionInfo.columnCount", columnCount); |
| + bundle.putBoolean("CollectionInfo.hierarchical", hierarchical); |
| + } |
| + |
| + @CalledByNative |
| + protected void setAccessibilityEventCollectionItemInfo(AccessibilityEvent event, |
| + int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading) { |
| + Bundle bundle = getOrCreateBundleForAccessibilityEvent(event); |
| + bundle.putInt("CollectionItemInfo.rowIndex", rowIndex); |
| + bundle.putInt("CollectionItemInfo.rowSpan", rowSpan); |
| + bundle.putInt("CollectionItemInfo.columnIndex", columnIndex); |
| + bundle.putInt("CollectionItemInfo.columnSpan", columnSpan); |
| + bundle.putBoolean("CollectionItemInfo.heading", heading); |
| + } |
| + |
| + @CalledByNative |
| + protected void setAccessibilityEventRangeInfo(AccessibilityEvent event, |
| + int rangeType, float min, float max, float current) { |
| + Bundle bundle = getOrCreateBundleForAccessibilityEvent(event); |
| + bundle.putInt("RangeInfo.type", rangeType); |
| + bundle.putFloat("RangeInfo.min", min); |
| + bundle.putFloat("RangeInfo.max", max); |
| + bundle.putFloat("RangeInfo.current", current); |
| + } |
| + |
| private native int nativeGetRootId(int nativeBrowserAccessibilityManagerAndroid); |
| private native int nativeHitTest(int nativeBrowserAccessibilityManagerAndroid, int x, int y); |
| private native boolean nativePopulateAccessibilityNodeInfo( |