OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PROVIDER_H_ | 5 #ifndef DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_ |
6 #define DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_ | 6 #define DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... |
35 virtual void OnGamepadConnectionChange(bool connected, | 35 virtual void OnGamepadConnectionChange(bool connected, |
36 int index, | 36 int index, |
37 const blink::WebGamepad& pad) = 0; | 37 const blink::WebGamepad& pad) = 0; |
38 }; | 38 }; |
39 | 39 |
40 class DEVICE_GAMEPAD_EXPORT GamepadProvider | 40 class DEVICE_GAMEPAD_EXPORT GamepadProvider |
41 : public GamepadPadStateProvider, | 41 : public GamepadPadStateProvider, |
42 public base::SystemMonitor::DevicesChangedObserver { | 42 public base::SystemMonitor::DevicesChangedObserver { |
43 public: | 43 public: |
44 explicit GamepadProvider( | 44 explicit GamepadProvider( |
45 std::unique_ptr<GamepadSharedBuffer> buffer, | |
46 GamepadConnectionChangeClient* connection_change_client); | 45 GamepadConnectionChangeClient* connection_change_client); |
47 | 46 |
48 // Manually specifies the data fetcher. Used for testing. | 47 // Manually specifies the data fetcher. Used for testing. |
49 explicit GamepadProvider( | 48 explicit GamepadProvider( |
50 std::unique_ptr<GamepadSharedBuffer> buffer, | |
51 GamepadConnectionChangeClient* connection_change_client, | 49 GamepadConnectionChangeClient* connection_change_client, |
52 std::unique_ptr<GamepadDataFetcher> fetcher); | 50 std::unique_ptr<GamepadDataFetcher> fetcher); |
53 | 51 |
54 ~GamepadProvider() override; | 52 ~GamepadProvider() override; |
55 | 53 |
56 // Returns the shared memory handle of the gamepad data duplicated into the | 54 // Returns the shared memory handle of the gamepad data duplicated into the |
57 // given process. | 55 // given process. |
58 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( | 56 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( |
59 base::ProcessHandle renderer_process); | 57 base::ProcessHandle renderer_process); |
60 | 58 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 std::unique_ptr<base::Thread> polling_thread_; | 161 std::unique_ptr<base::Thread> polling_thread_; |
164 | 162 |
165 GamepadConnectionChangeClient* connection_change_client_; | 163 GamepadConnectionChangeClient* connection_change_client_; |
166 | 164 |
167 DISALLOW_COPY_AND_ASSIGN(GamepadProvider); | 165 DISALLOW_COPY_AND_ASSIGN(GamepadProvider); |
168 }; | 166 }; |
169 | 167 |
170 } // namespace device | 168 } // namespace device |
171 | 169 |
172 #endif // DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_ | 170 #endif // DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_ |
OLD | NEW |