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

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

Issue 925923003: Update BrowserAccessibilityManager to support Lollipop SDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hover_debug
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatBrowserAccessibilityManager.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopBrowserAccessibilityManager.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatBrowserAccessibilityManager.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopBrowserAccessibilityManager.java
similarity index 50%
rename from content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatBrowserAccessibilityManager.java
rename to content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopBrowserAccessibilityManager.java
index 06bf18c693bb01152e1c4644351a1959eb5d4e4f..a966ed62b9e2e68afe5c671647075c0419becd30 100644
--- a/content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatBrowserAccessibilityManager.java
+++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopBrowserAccessibilityManager.java
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,27 +6,25 @@ package org.chromium.content.browser.accessibility;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
+import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.content.browser.ContentViewCore;
/**
- * Subclass of BrowserAccessibilityManager for KitKat that creates an
+ * Subclass of BrowserAccessibilityManager for Lollipop that creates an
* AccessibilityNodeProvider and delegates its implementation to this object.
- *
- * THIS CLASS IS NOT USED! A bug in the KitKat framework prevents us
- * from using these new APIs. We can re-enable this class after the next
- * Android system update. http://crbug.com/348088/
*/
@JNINamespace("content")
-public class KitKatBrowserAccessibilityManager extends JellyBeanBrowserAccessibilityManager {
- KitKatBrowserAccessibilityManager(long nativeBrowserAccessibilityManagerAndroid,
+public class LollipopBrowserAccessibilityManager extends JellyBeanBrowserAccessibilityManager {
+ LollipopBrowserAccessibilityManager(long nativeBrowserAccessibilityManagerAndroid,
ContentViewCore contentViewCore) {
super(nativeBrowserAccessibilityManagerAndroid, contentViewCore);
}
@Override
- protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node,
+ protected void setAccessibilityNodeInfoLollipopAttributes(AccessibilityNodeInfo node,
boolean canOpenPopup,
boolean contentInvalid,
boolean dismissable,
@@ -63,42 +61,85 @@ public class KitKatBrowserAccessibilityManager extends JellyBeanBrowserAccessibi
}
@Override
- protected void setAccessibilityEventKitKatAttributes(AccessibilityEvent event,
+ protected void setAccessibilityEventLollipopAttributes(AccessibilityEvent event,
boolean canOpenPopup,
boolean contentInvalid,
boolean dismissable,
boolean multiLine,
int inputType,
int liveRegion) {
- // This is just a fallback for pre-KitKat systems.
- // Do nothing on KitKat and higher.
+ // This is just a fallback for pre-Lollipop systems.
+ // Do nothing on Lollipop and higher.
}
@Override
protected void setAccessibilityEventCollectionInfo(AccessibilityEvent event,
int rowCount, int columnCount, boolean hierarchical) {
- // This is just a fallback for pre-KitKat systems.
- // Do nothing on KitKat and higher.
+ // This is just a fallback for pre-Lollipop systems.
+ // Do nothing on Lollipop and higher.
}
@Override
protected void setAccessibilityEventHeadingFlag(AccessibilityEvent event,
boolean heading) {
- // This is just a fallback for pre-KitKat systems.
- // Do nothing on KitKat and higher.
+ // This is just a fallback for pre-Lollipop systems.
+ // Do nothing on Lollipop and higher.
}
@Override
protected void setAccessibilityEventCollectionItemInfo(AccessibilityEvent event,
int rowIndex, int rowSpan, int columnIndex, int columnSpan) {
- // This is just a fallback for pre-KitKat systems.
- // Do nothing on KitKat and higher.
+ // This is just a fallback for pre-Lollipop systems.
+ // Do nothing on Lollipop and higher.
}
@Override
protected void setAccessibilityEventRangeInfo(AccessibilityEvent event,
int rangeType, float min, float max, float current) {
- // This is just a fallback for pre-KitKat systems.
- // Do nothing on KitKat and higher.
+ // This is just a fallback for pre-Lollipop systems.
+ // Do nothing on Lollipop and higher.
+ }
+
+ @CalledByNative
+ @Override
+ protected void addAccessibilityNodeInfoActions(AccessibilityNodeInfo node,
+ int virtualViewId, boolean canScrollForward, boolean canScrollBackward,
+ boolean clickable, boolean editableText, boolean enabled, boolean focusable,
+ boolean focused) {
+ node.addAction(AccessibilityAction.ACTION_NEXT_HTML_ELEMENT);
+ node.addAction(AccessibilityAction.ACTION_PREVIOUS_HTML_ELEMENT);
+ node.addAction(AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY);
+ node.addAction(AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY);
+
+ if (editableText && enabled) {
+ node.addAction(AccessibilityAction.ACTION_SET_TEXT);
+ node.addAction(AccessibilityAction.ACTION_SET_SELECTION);
+ }
+
+ if (canScrollForward) {
+ node.addAction(AccessibilityAction.ACTION_SCROLL_FORWARD);
+ }
+
+ if (canScrollBackward) {
+ node.addAction(AccessibilityAction.ACTION_SCROLL_BACKWARD);
+ }
+
+ if (focusable) {
+ if (focused) {
+ node.addAction(AccessibilityAction.ACTION_CLEAR_FOCUS);
+ } else {
+ node.addAction(AccessibilityAction.ACTION_FOCUS);
+ }
+ }
+
+ if (mAccessibilityFocusId == virtualViewId) {
+ node.addAction(AccessibilityAction.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
+ } else if (mVisible) {
+ node.addAction(AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS);
+ }
+
+ if (clickable) {
+ node.addAction(AccessibilityAction.ACTION_CLICK);
+ }
}
}
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatBrowserAccessibilityManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698