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 7921262064b3b3a91f7fa48be457f97fc2e933f7..582c788fce0a199c8fe1911e96eb9523764e78d6 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 |
@@ -129,6 +129,8 @@ public class ContentViewCore |
// expects HashSet (no bindings for interfaces). |
private final HashSet<Object> mRetainedJavaScriptObjects = new HashSet<Object>(); |
+ private GamepadList mGamepadList; |
+ |
/** |
* Interface that consumers of {@link ContentViewCore} must implement to allow the proper |
* dispatching of view methods through the containing view. |
@@ -481,6 +483,7 @@ public class ContentViewCore |
getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); |
mGestureStateListeners = new ObserverList<GestureStateListener>(); |
mGestureStateListenersIterator = mGestureStateListeners.rewindableIterator(); |
+ mGamepadList = GamepadList.createInstance(context); |
} |
/** |
@@ -1829,6 +1832,9 @@ public class ContentViewCore |
* @see View#dispatchKeyEvent(KeyEvent) |
*/ |
public boolean dispatchKeyEvent(KeyEvent event) { |
+ if (mGamepadList.isGamepadAccessed() && mGamepadList.isGamepadEvent(event)) { |
+ return mGamepadList.updateForEvent(event); |
+ } |
if (getContentViewClient().shouldOverrideKeyEvent(event)) { |
return mContainerViewInternals.super_dispatchKeyEvent(event); |
} |
@@ -1862,6 +1868,9 @@ public class ContentViewCore |
* @see View#onGenericMotionEvent(MotionEvent) |
*/ |
public boolean onGenericMotionEvent(MotionEvent event) { |
+ if (mGamepadList.isGamepadAccessed() && mGamepadList.isGamepadEvent(event)) { |
+ return mGamepadList.updateForEvent(event); |
+ } |
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { |
switch (event.getAction()) { |
case MotionEvent.ACTION_SCROLL: |