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 40f5bea32ab11a5c7d11f03c3d6cd28dcf96973d..682fc59c5837b8e68cf7be70f3eb491641f7d06b 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. |
| @@ -655,7 +660,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| initializeContainerView(internalDispatcher, inputEventDeliveryMode); |
| mAccessibilityInjector = AccessibilityInjector.newInstance(this); |
| - mAccessibilityInjector.addOrRemoveAccessibilityApisIfNecessary(); |
| + //mAccessibilityInjector.addOrRemoveAccessibilityApisIfNecessary(); |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
Uncomment.
dmazzoni
2013/06/07 20:23:16
Done. Alice is fixing it so that either native acc
|
| String contentDescription = "Web View"; |
| if (R.string.accessibility_content_view == 0) { |
| @@ -1107,7 +1112,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| * Reload the current page. |
| */ |
| public void reload() { |
| - mAccessibilityInjector.addOrRemoveAccessibilityApisIfNecessary(); |
| + //mAccessibilityInjector.addOrRemoveAccessibilityApisIfNecessary(); |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
Uncomment.
dmazzoni
2013/06/07 20:23:16
Done.
|
| if (mNativeContentViewCore != 0) nativeReload(mNativeContentViewCore); |
| } |
| @@ -1666,6 +1671,16 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| } |
| /** |
| + * @see View#dispatchHoverEvent(MotionEvent) |
| + */ |
| + public boolean dispatchHoverEvent(MotionEvent event) { |
| + if (mBrowserAccessibilityManager != null) |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
Is this a proper check to tell if accessibility is
dmazzoni
2013/06/07 20:23:16
I think this one is fine. We should fix the code s
|
| + return mBrowserAccessibilityManager.dispatchHoverEvent(event); |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
{ } around if blocks in Java (unless you can fit t
|
| + else |
| + return false; // TODO: call super on ContentView's dispatchHoverEvent? |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
Probably, since it would have hit the root view in
dmazzoni
2013/06/07 20:23:16
Done.
|
| + } |
| + |
| + /** |
| * @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() |
| @@ -2199,6 +2214,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| controlsOffsetPix, contentOffsetYPix, overdrawBottomHeightPix); |
| mPendingRendererFrame = true; |
| + mBrowserAccessibilityManager.notifyFrameInfoInitialized(); |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
null check? You do it above.
dmazzoni
2013/06/07 20:23:16
Done.
|
| } |
| @SuppressWarnings("unused") |
| @@ -2601,17 +2617,34 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
| * the super {@link View} class. |
| */ |
| public boolean performAccessibilityAction(int action, Bundle arguments) { |
| + /* |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
Uncomment before landing.
IMO Add a boolean above
dmazzoni
2013/06/07 20:23:16
Done.
|
| if (mAccessibilityInjector.supportsAccessibilityAction(action)) { |
| return mAccessibilityInjector.performAccessibilityAction(action, arguments); |
| - } |
| + }*/ |
| return false; |
| } |
| + public void setBrowserAccessibilityManager(BrowserAccessibilityManager manager) { |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
Javadoc.
dmazzoni
2013/06/07 20:23:16
Done.
|
| + mBrowserAccessibilityManager = manager; |
| + } |
| + |
| + public BrowserAccessibilityManager getBrowserAccessibilityManager() { |
|
David Trainor- moved to gerrit
2013/06/04 20:27:18
Javadoc
dmazzoni
2013/06/07 20:23:16
Done.
|
| + return mBrowserAccessibilityManager; |
| + } |
| + |
| + /** |
| + * @see View#getAccessibilityNodeProvider(View host) |
| + */ |
| + public AccessibilityNodeProvider getAccessibilityNodeProvider(View host) { |
|
benm (inactive)
2013/06/05 10:52:40
Do we need the |host| param here?
dmazzoni
2013/06/07 20:23:16
Done.
|
| + 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); |
| } |
| @@ -2619,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. |