Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java

Issue 67473013: Support KitKat accessibility APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add dummy Mac and Win expectations Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 2cf58bec1d3c4470b7b2313014ce3f976bd043fe..ff02f1d647b02da38cdc615c34007d6a25937de5 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
@@ -61,7 +61,10 @@ public class BrowserAccessibilityManager {
@CalledByNative
private static BrowserAccessibilityManager create(long 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 {
@@ -240,6 +243,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;
@@ -395,6 +407,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);
@@ -443,6 +484,57 @@ 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) {
+ // Backwards compatibility for KitKat AccessibilityNodeInfo fields.
+ Bundle bundle = getOrCreateBundleForAccessibilityEvent(event);
+ bundle.putBoolean("AccessibilityNodeInfo.canOpenPopup", canOpenPopup);
+ bundle.putBoolean("AccessibilityNodeInfo.contentInvalid", contentInvalid);
+ bundle.putBoolean("AccessibilityNodeInfo.dismissable", dismissable);
+ bundle.putBoolean("AccessibilityNodeInfo.multiLine", multiLine);
+ bundle.putInt("AccessibilityNodeInfo.inputType", inputType);
+ bundle.putInt("AccessibilityNodeInfo.liveRegion", liveRegion);
+ }
+
+ @CalledByNative
+ protected void setAccessibilityEventCollectionInfo(AccessibilityEvent event,
+ int rowCount, int columnCount, boolean hierarchical) {
+ // Backwards compatibility for KitKat AccessibilityNodeInfo fields.
+ Bundle bundle = getOrCreateBundleForAccessibilityEvent(event);
+ bundle.putInt("AccessibilityNodeInfo.CollectionInfo.rowCount", rowCount);
+ bundle.putInt("AccessibilityNodeInfo.CollectionInfo.columnCount", columnCount);
+ bundle.putBoolean("AccessibilityNodeInfo.CollectionInfo.hierarchical", hierarchical);
+ }
+
+ @CalledByNative
+ protected void setAccessibilityEventCollectionItemInfo(AccessibilityEvent event,
+ int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading) {
+ // Backwards compatibility for KitKat AccessibilityNodeInfo fields.
+ Bundle bundle = getOrCreateBundleForAccessibilityEvent(event);
+ bundle.putInt("AccessibilityNodeInfo.CollectionItemInfo.rowIndex", rowIndex);
+ bundle.putInt("AccessibilityNodeInfo.CollectionItemInfo.rowSpan", rowSpan);
+ bundle.putInt("AccessibilityNodeInfo.CollectionItemInfo.columnIndex", columnIndex);
+ bundle.putInt("AccessibilityNodeInfo.CollectionItemInfo.columnSpan", columnSpan);
+ bundle.putBoolean("AccessibilityNodeInfo.CollectionItemInfo.heading", heading);
+ }
+
+ @CalledByNative
+ protected void setAccessibilityEventRangeInfo(AccessibilityEvent event,
+ int rangeType, float min, float max, float current) {
+ // Backwards compatibility for KitKat AccessibilityNodeInfo fields.
+ Bundle bundle = getOrCreateBundleForAccessibilityEvent(event);
+ bundle.putInt("AccessibilityNodeInfo.RangeInfo.type", rangeType);
+ bundle.putFloat("AccessibilityNodeInfo.RangeInfo.min", min);
+ bundle.putFloat("AccessibilityNodeInfo.RangeInfo.max", max);
+ bundle.putFloat("AccessibilityNodeInfo.RangeInfo.current", current);
+ }
+
private native int nativeGetRootId(long nativeBrowserAccessibilityManagerAndroid);
private native int nativeHitTest(long nativeBrowserAccessibilityManagerAndroid, int x, int y);
private native boolean nativePopulateAccessibilityNodeInfo(

Powered by Google App Engine
This is Rietveld 408576698