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

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

Issue 165483003: Gamepad API for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated 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 6183891f676cf9f4cffce801da100b082a4d9323..3b72327e335540089830d879ea2c467d7b260784 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
@@ -59,6 +59,7 @@ import org.chromium.content.R;
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.GamepadAdapter;
import org.chromium.content.browser.input.HandleView;
import org.chromium.content.browser.input.ImeAdapter;
import org.chromium.content.browser.input.ImeAdapter.AdapterInputConnectionFactory;
@@ -447,6 +448,7 @@ public class ContentViewCore implements NavigationClient, AccessibilityStateChan
getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
mGestureStateListeners = new ObserverList<GestureStateListener>();
mGestureStateListenersIterator = mGestureStateListeners.rewindableIterator();
+ GamepadAdapter.initialize(context);
}
/**
@@ -1371,6 +1373,7 @@ public class ContentViewCore implements NavigationClient, AccessibilityStateChan
ChildProcessLauncher.getBindingManager().setInForeground(pid, true);
}
mInForeground = true;
+ GamepadAdapter.getInstance().resume();
nativeOnShow(mNativeContentViewCore);
setAccessibilityState(mAccessibilityManager.isEnabled());
}
@@ -1387,6 +1390,7 @@ public class ContentViewCore implements NavigationClient, AccessibilityStateChan
mInForeground = false;
hidePopupDialog();
setInjectedAccessibility(false);
+ GamepadAdapter.getInstance().pause();
nativeOnHide(mNativeContentViewCore);
}
@@ -1690,10 +1694,13 @@ public class ContentViewCore implements NavigationClient, AccessibilityStateChan
* @see View#dispatchKeyEvent(KeyEvent)
*/
public boolean dispatchKeyEvent(KeyEvent event) {
+
bulach 2014/03/05 12:34:39 nit: spurious?
if (getContentViewClient().shouldOverrideKeyEvent(event)) {
return mContainerViewInternals.super_dispatchKeyEvent(event);
}
+ if (GamepadAdapter.getInstance().handleKeyEvent(event)) return true;
+
if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) {
showImeIfNeeded();
// Event is not consumed here, because ImeAdapter might interpret
@@ -1755,6 +1762,9 @@ public class ContentViewCore implements NavigationClient, AccessibilityStateChan
return true;
}
}
+
+ if (GamepadAdapter.getInstance().handleMotionEvent(event)) return true;
+
return mContainerViewInternals.super_onGenericMotionEvent(event);
}

Powered by Google App Engine
This is Rietveld 408576698