Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| index 58ff66c09d8348ca5fb86e39c65c6ffe30f28198..d7c6b769de41cecd9f089bd0c2502122fb045d52 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| @@ -31,6 +31,7 @@ import android.view.Window; |
| import android.view.WindowManager; |
| import android.view.accessibility.AccessibilityEvent; |
| import android.view.accessibility.AccessibilityNodeInfo; |
| +import android.view.accessibility.AccessibilityNodeProvider; |
| import android.view.inputmethod.EditorInfo; |
| import android.view.inputmethod.InputConnection; |
| import android.view.inputmethod.InputMethodManager; |
| @@ -44,6 +45,7 @@ import org.chromium.base.WeakContext; |
| import org.chromium.content.R; |
| import org.chromium.content.browser.ContentViewGestureHandler.MotionEventDelegate; |
| import org.chromium.content.browser.accessibility.AccessibilityInjector; |
| +import org.chromium.content.browser.accessibility.BrowserAccessibilityManager; |
| import org.chromium.content.browser.input.AdapterInputConnection; |
| import org.chromium.content.browser.input.HandleView; |
| import org.chromium.content.browser.input.ImeAdapter; |
| @@ -374,6 +376,9 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| private ViewAndroid mViewAndroid; |
| + // Handles native accessibility, i.e. without any script injection. |
| + private BrowserAccessibilityManager mBrowserAccessibilityManager; |
| + |
| /** |
| * Constructs a new ContentViewCore. Embedders must call initialize() after constructing |
| * a ContentViewCore and before using it. |
| @@ -1651,6 +1656,18 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| } |
| /** |
| + * @see View#dispatchHoverEvent(MotionEvent) |
| + */ |
| + public boolean dispatchHoverEvent(MotionEvent event) { |
| + if (mBrowserAccessibilityManager != null) { |
| + return mBrowserAccessibilityManager.dispatchHoverEvent(event); |
| + } else { |
| + // ContentView.dispatchHoverEvent will call super. |
| + return false; |
| + } |
| + } |
| + |
| + /** |
| * @see View#scrollBy(int, int) |
| * Currently the ContentView scrolling happens in the native side. In |
| * the Java view system, it is always pinned at (0, 0). scrollBy() and scrollTo() |
| @@ -2184,6 +2201,9 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| controlsOffsetPix, contentOffsetYPix, overdrawBottomHeightPix); |
| mPendingRendererFrame = true; |
| + if (mBrowserAccessibilityManager != null) { |
| + mBrowserAccessibilityManager.notifyFrameInfoInitialized(); |
| + } |
| } |
| @SuppressWarnings("unused") |
| @@ -2594,9 +2614,37 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| } |
| /** |
| + * Set the BrowserAccessibilityManager, used for native accessibility |
| + * (not script injection). This is only set when system accessibility |
| + * has been enabled. |
| + * @param manager The new BrowserAccessibilityManager. |
| + */ |
| + public void setBrowserAccessibilityManager(BrowserAccessibilityManager manager) { |
| + mBrowserAccessibilityManager = manager; |
|
benm (inactive)
2013/06/10 14:24:24
Where do we check if the embedder has the INTERNET
dmazzoni
2013/06/18 20:22:35
This is all handled correctly in ContentViewCore n
|
| + } |
| + |
| + /** |
| + * Get the BrowserAccessibilityManager, used for native accessibility |
| + * (not script injection). This will return null when system accessibility |
| + * is not enabled. |
| + * @return This view's BrowserAccessibilityManager. |
| + */ |
| + public BrowserAccessibilityManager getBrowserAccessibilityManager() { |
| + return mBrowserAccessibilityManager; |
| + } |
| + |
| + /** |
| + * @see View#getAccessibilityNodeProvider(View host) |
| + */ |
| + public AccessibilityNodeProvider getAccessibilityNodeProvider() { |
| + return mBrowserAccessibilityManager; |
| + } |
| + |
| + /** |
| * @see View#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo) |
| */ |
| public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { |
| + // Note: this is only used by the script-injecting accessibility code. |
| mAccessibilityInjector.onInitializeAccessibilityNodeInfo(info); |
| } |
| @@ -2604,6 +2652,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| * @see View#onInitializeAccessibilityEvent(AccessibilityEvent) |
| */ |
| public void onInitializeAccessibilityEvent(AccessibilityEvent event) { |
| + // Note: this is only used by the script-injecting accessibility code. |
| event.setClassName(this.getClass().getName()); |
| // Identify where the top-left of the screen currently points to. |