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..a3116345d523c1c4bdbb458055d290d4ec3a16fe 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)) { |
kbalazs
2014/02/20 00:48:24
I would move both checks to the callee and remove
|
+ return mGamepadList.updateForEvent(event); |
+ } |
if (getContentViewClient().shouldOverrideKeyEvent(event)) { |
return mContainerViewInternals.super_dispatchKeyEvent(event); |
} |
@@ -1838,6 +1844,18 @@ public class ContentViewCore |
return mContainerViewInternals.super_dispatchKeyEvent(event); |
} |
+ public void onPause() { |
+ if (mGamepadList != null) { |
+ mGamepadList.onPause(); |
+ } |
+ } |
+ |
+ public void onResume() { |
+ if (mGamepadList != null) { |
+ mGamepadList.onResume(); |
+ } |
+ } |
+ |
/** |
* @see View#onHoverEvent(MotionEvent) |
* Mouse move events are sent on hover enter, hover move and hover exit. |
@@ -1862,6 +1880,9 @@ public class ContentViewCore |
* @see View#onGenericMotionEvent(MotionEvent) |
*/ |
public boolean onGenericMotionEvent(MotionEvent event) { |
+ if (mGamepadList.isGamepadAccessed() && mGamepadList.isGamepadEvent(event)) { |
kbalazs
2014/02/20 00:48:24
Ditto.
|
+ return mGamepadList.updateForEvent(event); |
+ } |
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { |
switch (event.getAction()) { |
case MotionEvent.ACTION_SCROLL: |