OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_H_ | 5 #ifndef DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_H_ |
6 #define DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_H_ | 6 #define DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
11 | 11 |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "device/gamepad/gamepad_export.h" |
13 #include "device/gamepad/gamepad_standard_mappings.h" | 14 #include "device/gamepad/gamepad_standard_mappings.h" |
14 #include "third_party/WebKit/public/platform/WebGamepads.h" | 15 #include "third_party/WebKit/public/platform/WebGamepads.h" |
15 | 16 |
16 namespace device { | 17 namespace device { |
17 | 18 |
18 // Abstract interface for imlementing platform- (and test-) specific behaviro | 19 // Abstract interface for imlementing platform- (and test-) specific behaviro |
19 // for getting the gamepad data. | 20 // for getting the gamepad data. |
20 class GamepadDataFetcher { | 21 class DEVICE_GAMEPAD_EXPORT GamepadDataFetcher { |
21 public: | 22 public: |
22 virtual ~GamepadDataFetcher() {} | 23 virtual ~GamepadDataFetcher() {} |
23 virtual void GetGamepadData(blink::WebGamepads* pads, | 24 virtual void GetGamepadData(blink::WebGamepads* pads, |
24 bool devices_changed_hint) = 0; | 25 bool devices_changed_hint) = 0; |
25 virtual void PauseHint(bool paused) {} | 26 virtual void PauseHint(bool paused) {} |
26 | 27 |
27 #if !defined(OS_ANDROID) | 28 #if !defined(OS_ANDROID) |
28 struct PadState { | 29 struct PadState { |
29 // Gamepad data, unmapped. | 30 // Gamepad data, unmapped. |
30 blink::WebGamepad data; | 31 blink::WebGamepad data; |
(...skipping 23 matching lines...) Expand all Loading... |
54 void MapAndSanitizeGamepadData(PadState* pad_state, blink::WebGamepad* pad); | 55 void MapAndSanitizeGamepadData(PadState* pad_state, blink::WebGamepad* pad); |
55 | 56 |
56 protected: | 57 protected: |
57 PadState pad_state_[blink::WebGamepads::itemsLengthCap]; | 58 PadState pad_state_[blink::WebGamepads::itemsLengthCap]; |
58 #endif | 59 #endif |
59 }; | 60 }; |
60 | 61 |
61 } // namespace device | 62 } // namespace device |
62 | 63 |
63 #endif // DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_H_ | 64 #endif // DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_H_ |
OLD | NEW |