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

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

Issue 1276703003: Handle UI operations through gamepad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java b/content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java
index 5d71109758802bb8e521184c4db73167ddbcd783..6f75214f69e0901dd265e46c2d8f2b38fe877f47 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java
@@ -33,7 +33,7 @@ public class GamepadList {
private final GamepadDevice[] mGamepadDevices = new GamepadDevice[MAX_GAMEPADS];
private InputManager mInputManager;
private int mAttachedToWindowCounter;
- private boolean mIsGamepadAccessed;
+ private boolean mIsGamepadAPIActive;
private InputDeviceListener mInputDeviceListener;
private GamepadList() {
@@ -179,7 +179,7 @@ public class GamepadList {
private boolean handleKeyEvent(KeyEvent event) {
synchronized (mLock) {
- if (!mIsGamepadAccessed) return false;
+ if (!mIsGamepadAPIActive) return false;
GamepadDevice gamepad = getGamepadForEvent(event);
if (gamepad == null) return false;
return gamepad.handleKeyEvent(event);
@@ -197,7 +197,7 @@ public class GamepadList {
private boolean handleMotionEvent(MotionEvent event) {
synchronized (mLock) {
- if (!mIsGamepadAccessed) return false;
+ if (!mIsGamepadAPIActive) return false;
GamepadDevice gamepad = getGamepadForEvent(event);
if (gamepad == null) return false;
return gamepad.handleMotionEvent(event);
@@ -247,6 +247,13 @@ public class GamepadList {
}
/**
+ * @return True if HTML5 gamepad API is active.
+ */
+ public static boolean isGamepadAPIActive() {
+ return getInstance().mIsGamepadAPIActive;
+ }
+
+ /**
* @return True if the motion event corresponds to a gamepad event.
*/
public static boolean isGamepadEvent(MotionEvent event) {
@@ -293,14 +300,14 @@ public class GamepadList {
}
@CalledByNative
- static void notifyForGamepadsAccess(boolean isAccessPaused) {
- getInstance().setIsGamepadAccessed(!isAccessPaused);
+ static void setGamepadAPIActive(boolean isActive) {
+ getInstance().setIsGamepadActive(isActive);
}
- private void setIsGamepadAccessed(boolean isGamepadAccessed) {
+ private void setIsGamepadActive(boolean isGamepadActive) {
synchronized (mLock) {
- mIsGamepadAccessed = isGamepadAccessed;
- if (isGamepadAccessed) {
+ mIsGamepadAPIActive = isGamepadActive;
+ if (isGamepadActive) {
for (int i = 0; i < MAX_GAMEPADS; i++) {
GamepadDevice gamepadDevice = getDevice(i);
if (gamepadDevice == null) continue;
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698