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 CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_ | 5 #ifndef DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_ |
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_ | 6 #define DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "content/browser/gamepad/gamepad_data_fetcher.h" | 15 #include "device/gamepad/gamepad_data_fetcher.h" |
16 | 16 |
17 extern "C" { | 17 extern "C" { |
18 struct udev_device; | 18 struct udev_device; |
19 } | 19 } |
20 | 20 |
21 namespace device { | 21 namespace device { |
22 class UdevLinux; | 22 class UdevLinux; |
23 } | 23 } |
24 | 24 |
25 namespace content { | 25 namespace device { |
26 | 26 |
27 class GamepadPlatformDataFetcherLinux : public GamepadDataFetcher { | 27 class GamepadPlatformDataFetcherLinux : public GamepadDataFetcher { |
28 public: | 28 public: |
29 GamepadPlatformDataFetcherLinux(); | 29 GamepadPlatformDataFetcherLinux(); |
30 ~GamepadPlatformDataFetcherLinux() override; | 30 ~GamepadPlatformDataFetcherLinux() override; |
31 | 31 |
32 // GamepadDataFetcher implementation. | 32 // GamepadDataFetcher implementation. |
33 void GetGamepadData(blink::WebGamepads* pads, | 33 void GetGamepadData(blink::WebGamepads* pads, |
34 bool devices_changed_hint) override; | 34 bool devices_changed_hint) override; |
35 | 35 |
36 private: | 36 private: |
37 void RefreshDevice(udev_device* dev); | 37 void RefreshDevice(udev_device* dev); |
38 void EnumerateDevices(); | 38 void EnumerateDevices(); |
39 void ReadDeviceData(size_t index); | 39 void ReadDeviceData(size_t index); |
40 | 40 |
41 // File descriptor for the /dev/input/js* devices. -1 if not in use. | 41 // File descriptor for the /dev/input/js* devices. -1 if not in use. |
42 int device_fd_[blink::WebGamepads::itemsLengthCap]; | 42 int device_fd_[blink::WebGamepads::itemsLengthCap]; |
43 | 43 |
44 std::unique_ptr<device::UdevLinux> udev_; | 44 std::unique_ptr<device::UdevLinux> udev_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherLinux); | 46 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherLinux); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace content | 49 } // namespace device |
50 | 50 |
51 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_ | 51 #endif // DEVICE_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_ |
OLD | NEW |