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

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

Issue 133943002: Gamepad API support for chrome on android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 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
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:

Powered by Google App Engine
This is Rietveld 408576698