| 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 "device/gamepad/gamepad_platform_data_fetcher_android.h" | 5 #include "device/gamepad/gamepad_platform_data_fetcher_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| 11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 | 16 |
| 17 #include "jni/GamepadList_jni.h" | 17 #include "jni/GamepadList_jni.h" |
| 18 | 18 |
| 19 #include "third_party/WebKit/public/platform/WebGamepads.h" | 19 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 20 | 20 |
| 21 using base::android::AttachCurrentThread; | 21 using base::android::AttachCurrentThread; |
| 22 using base::android::CheckException; | 22 using base::android::CheckException; |
| 23 using base::android::ClearException; | 23 using base::android::ClearException; |
| 24 using base::android::ConvertJavaStringToUTF8; | 24 using base::android::ConvertJavaStringToUTF8; |
| 25 using base::android::JavaParamRef; |
| 25 using base::android::ScopedJavaLocalRef; | 26 using base::android::ScopedJavaLocalRef; |
| 26 using blink::WebGamepad; | 27 using blink::WebGamepad; |
| 27 using blink::WebGamepads; | 28 using blink::WebGamepads; |
| 28 | 29 |
| 29 namespace device { | 30 namespace device { |
| 30 | 31 |
| 31 bool GamepadPlatformDataFetcherAndroid:: | 32 bool GamepadPlatformDataFetcherAndroid:: |
| 32 RegisterGamepadPlatformDataFetcherAndroid(JNIEnv* env) { | 33 RegisterGamepadPlatformDataFetcherAndroid(JNIEnv* env) { |
| 33 return RegisterNativesImpl(env); | 34 return RegisterNativesImpl(env); |
| 34 } | 35 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 static_cast<int>(WebGamepad::buttonsLengthCap)); | 140 static_cast<int>(WebGamepad::buttonsLengthCap)); |
| 140 | 141 |
| 141 // Copy buttons state to the WebGamepad buttons[]. | 142 // Copy buttons state to the WebGamepad buttons[]. |
| 142 for (unsigned int j = 0; j < pad.buttonsLength; j++) { | 143 for (unsigned int j = 0; j < pad.buttonsLength; j++) { |
| 143 pad.buttons[j].pressed = buttons[j]; | 144 pad.buttons[j].pressed = buttons[j]; |
| 144 pad.buttons[j].value = buttons[j]; | 145 pad.buttons[j].value = buttons[j]; |
| 145 } | 146 } |
| 146 } | 147 } |
| 147 | 148 |
| 148 } // namespace device | 149 } // namespace device |
| OLD | NEW |