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