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 // Define the data fetcher that GamepadProvider will use for android port. | 5 // Define the data fetcher that GamepadProvider will use for android port. |
6 // (GamepadPlatformDataFetcher). | 6 // (GamepadPlatformDataFetcher). |
7 | 7 |
8 #ifndef DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_ANDROID_H_ | 8 #ifndef DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_ANDROID_H_ |
9 #define DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_ANDROID_H_ | 9 #define DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_ANDROID_H_ |
10 | 10 |
11 #include <jni.h> | 11 #include <jni.h> |
12 | 12 |
13 #include "base/android/jni_android.h" | 13 #include "base/android/jni_android.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "device/gamepad/gamepad_data_fetcher.h" | 15 #include "device/gamepad/gamepad_data_fetcher.h" |
16 #include "device/gamepad/gamepad_provider.h" | 16 #include "device/gamepad/gamepad_provider.h" |
17 #include "device/gamepad/gamepad_standard_mappings.h" | 17 #include "device/gamepad/gamepad_standard_mappings.h" |
18 #include "third_party/WebKit/public/platform/WebGamepads.h" | 18 #include "third_party/WebKit/public/platform/WebGamepads.h" |
19 | 19 |
20 namespace device { | 20 namespace device { |
21 | 21 |
22 class GamepadPlatformDataFetcherAndroid : public GamepadDataFetcher { | 22 class GamepadPlatformDataFetcherAndroid : public GamepadDataFetcher { |
23 public: | 23 public: |
| 24 typedef GamepadDataFetcherFactoryImpl<GamepadPlatformDataFetcherAndroid, |
| 25 GAMEPAD_SOURCE_ANDROID> |
| 26 Factory; |
| 27 |
24 GamepadPlatformDataFetcherAndroid(); | 28 GamepadPlatformDataFetcherAndroid(); |
25 ~GamepadPlatformDataFetcherAndroid() override; | 29 ~GamepadPlatformDataFetcherAndroid() override; |
26 | 30 |
| 31 GamepadSource source() override; |
| 32 |
27 void PauseHint(bool paused) override; | 33 void PauseHint(bool paused) override; |
28 | 34 |
29 void GetGamepadData(blink::WebGamepads* pads, | 35 void GetGamepadData(bool devices_changed_hint) override; |
30 bool devices_changed_hint) override; | |
31 | 36 |
32 // Registers the JNI methods for GamepadsReader. | 37 // Registers the JNI methods for GamepadsReader. |
33 static bool RegisterGamepadPlatformDataFetcherAndroid(JNIEnv* env); | 38 static bool RegisterGamepadPlatformDataFetcherAndroid(JNIEnv* env); |
34 | 39 |
35 private: | 40 private: |
| 41 void OnAddedToProvider() override; |
| 42 |
36 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherAndroid); | 43 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherAndroid); |
37 }; | 44 }; |
38 | 45 |
39 } // namespace device | 46 } // namespace device |
40 | 47 |
41 #endif // DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_ANDROID_H_ | 48 #endif // DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_ANDROID_H_ |
OLD | NEW |