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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser.input; 5 package org.chromium.content.browser.input;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.hardware.input.InputManager; 9 import android.hardware.input.InputManager;
10 import android.hardware.input.InputManager.InputDeviceListener; 10 import android.hardware.input.InputManager.InputDeviceListener;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 } 291 }
292 } 292 }
293 } 293 }
294 294
295 @CalledByNative 295 @CalledByNative
296 static void notifyForGamepadsAccess(boolean isAccessPaused) { 296 static void notifyForGamepadsAccess(boolean isAccessPaused) {
297 getInstance().setIsGamepadAccessed(!isAccessPaused); 297 getInstance().setIsGamepadAccessed(!isAccessPaused);
298 } 298 }
299 299
300 public static boolean isGamepadAccessed() {
301 return getInstance().mIsGamepadAccessed;
jdduke (slow) 2015/08/07 18:19:30 Can you move this method up below "isGamepadEvent"
302 }
300 private void setIsGamepadAccessed(boolean isGamepadAccessed) { 303 private void setIsGamepadAccessed(boolean isGamepadAccessed) {
301 synchronized (mLock) { 304 synchronized (mLock) {
302 mIsGamepadAccessed = isGamepadAccessed; 305 mIsGamepadAccessed = isGamepadAccessed;
303 if (isGamepadAccessed) { 306 if (isGamepadAccessed) {
304 for (int i = 0; i < MAX_GAMEPADS; i++) { 307 for (int i = 0; i < MAX_GAMEPADS; i++) {
305 GamepadDevice gamepadDevice = getDevice(i); 308 GamepadDevice gamepadDevice = getDevice(i);
306 if (gamepadDevice == null) continue; 309 if (gamepadDevice == null) continue;
307 gamepadDevice.clearData(); 310 gamepadDevice.clearData();
308 } 311 }
309 } 312 }
310 } 313 }
311 } 314 }
312 315
313 private native void nativeSetGamepadData(long webGamepadsPtr, int index, boo lean mapping, 316 private native void nativeSetGamepadData(long webGamepadsPtr, int index, boo lean mapping,
314 boolean connected, String devicename, long timestamp, float[] axes, float[] buttons); 317 boolean connected, String devicename, long timestamp, float[] axes, float[] buttons);
315 318
316 private static class LazyHolder { 319 private static class LazyHolder {
317 private static final GamepadList INSTANCE = new GamepadList(); 320 private static final GamepadList INSTANCE = new GamepadList();
318 } 321 }
319 322
320 } 323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698