OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_GAMEPAD_DATA_FETCHER_LINUX_H_ | |
6 #define CONTENT_BROWSER_GAMEPAD_DATA_FETCHER_LINUX_H_ | |
7 | |
8 #include "build/build_config.h" | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "content/browser/gamepad/data_fetcher.h" | |
12 #include "content/browser/gamepad/gamepad_standard_mappings_linux.h" | |
13 #include "content/common/gamepad_hardware_buffer.h" | |
14 | |
15 #include <string> | |
Ryan Sleevi
2011/12/17 04:31:14
random drive-by style nit: #include <string> befor
scottmg
2011/12/19 19:41:45
Done.
| |
16 extern "C" { | |
17 struct udev; | |
18 struct udev_device; | |
19 struct udev_monitor; | |
20 } | |
21 | |
22 namespace content { | |
23 | |
24 class GamepadPlatformDataFetcherLinux : public GamepadDataFetcher { | |
25 public: | |
26 GamepadPlatformDataFetcherLinux(); | |
27 virtual void GetGamepadData(WebKit::WebGamepads* pads, | |
Ryan Sleevi
2011/12/17 04:31:14
style nit: Declare DTORs before methods
http://go
scottmg
2011/12/19 19:41:45
Done.
| |
28 bool devices_changed_hint) OVERRIDE; | |
29 virtual ~GamepadPlatformDataFetcherLinux() OVERRIDE; | |
30 | |
31 private: | |
32 void EnumerateDevices(); | |
33 void RefreshDevice(udev_device* dev); | |
34 bool IsGamepad(udev_device* dev, size_t& index, std::string& path); | |
35 void CheckForAddRemoveEvents(); | |
36 void ReadDeviceData(size_t index); | |
37 | |
38 // libudev-related items, the main context, and the monitoring context to be | |
39 // notified about changes to device states. | |
40 udev* udev_; | |
41 udev_monitor* monitor_; | |
42 int monitor_fd_; | |
43 | |
44 // File descriptors for the /dev/input/js* devices. -1 if not in use. | |
45 int device_fds_[WebKit::WebGamepads::itemsLengthCap]; | |
46 | |
47 // Functions to map from device data to standard layout, if available. May | |
48 // be null if no mapping is available. | |
49 GamepadStandardMappingFunction mappers_[WebKit::WebGamepads::itemsLengthCap]; | |
50 | |
51 // Data that's returned to the consumer. | |
52 WebKit::WebGamepads data_; | |
53 }; | |
54 | |
55 } // namespace content | |
56 | |
57 #endif // CONTENT_BROWSER_GAMEPAD_DATA_FETCHER_LINUX_H_ | |
OLD | NEW |