OLD | NEW |
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 #include "content/browser/gamepad/gamepad_platform_data_fetcher_android.h" | 5 #include "content/browser/gamepad/gamepad_platform_data_fetcher_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return; | 52 return; |
53 | 53 |
54 Java_GamepadList_updateGamepadData(env, reinterpret_cast<intptr_t>(pads)); | 54 Java_GamepadList_updateGamepadData(env, reinterpret_cast<intptr_t>(pads)); |
55 } | 55 } |
56 | 56 |
57 void GamepadPlatformDataFetcherAndroid::PauseHint(bool paused) { | 57 void GamepadPlatformDataFetcherAndroid::PauseHint(bool paused) { |
58 JNIEnv* env = AttachCurrentThread(); | 58 JNIEnv* env = AttachCurrentThread(); |
59 if (!env) | 59 if (!env) |
60 return; | 60 return; |
61 | 61 |
62 Java_GamepadList_notifyForGamepadsAccess(env, paused); | 62 Java_GamepadList_setGamepadAPIActive(env, !paused); |
63 } | 63 } |
64 | 64 |
65 static void SetGamepadData(JNIEnv* env, | 65 static void SetGamepadData(JNIEnv* env, |
66 jobject obj, | 66 jobject obj, |
67 jlong gamepads, | 67 jlong gamepads, |
68 jint index, | 68 jint index, |
69 jboolean mapping, | 69 jboolean mapping, |
70 jboolean connected, | 70 jboolean connected, |
71 jstring devicename, | 71 jstring devicename, |
72 jlong timestamp, | 72 jlong timestamp, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 static_cast<int>(WebGamepad::buttonsLengthCap)); | 140 static_cast<int>(WebGamepad::buttonsLengthCap)); |
141 | 141 |
142 // Copy buttons state to the WebGamepad buttons[]. | 142 // Copy buttons state to the WebGamepad buttons[]. |
143 for (unsigned int j = 0; j < pad.buttonsLength; j++) { | 143 for (unsigned int j = 0; j < pad.buttonsLength; j++) { |
144 pad.buttons[j].pressed = buttons[j]; | 144 pad.buttons[j].pressed = buttons[j]; |
145 pad.buttons[j].value = buttons[j]; | 145 pad.buttons[j].value = buttons[j]; |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 } // namespace content | 149 } // namespace content |
OLD | NEW |