Remove PlatformFile from profile_browsertest
[chromium-blink-merge.git] / content / browser / gamepad / gamepad_platform_data_fetcher_linux.h
blobf95e52fc0b2795b8b199e2679295d060ded20752
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.
5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/browser/gamepad/gamepad_data_fetcher.h"
14 #include "content/browser/gamepad/gamepad_standard_mappings.h"
15 #include "third_party/WebKit/public/platform/WebGamepads.h"
17 extern "C" {
18 struct udev_device;
21 namespace content {
23 class UdevLinux;
25 class GamepadPlatformDataFetcherLinux : public GamepadDataFetcher {
26 public:
27 GamepadPlatformDataFetcherLinux();
28 virtual ~GamepadPlatformDataFetcherLinux();
30 // GamepadDataFetcher implementation.
31 virtual void GetGamepadData(blink::WebGamepads* pads,
32 bool devices_changed_hint) OVERRIDE;
34 private:
35 void RefreshDevice(udev_device* dev);
36 void EnumerateDevices();
37 void ReadDeviceData(size_t index);
39 // File descriptors for the /dev/input/js* devices. -1 if not in use.
40 int device_fds_[blink::WebGamepads::itemsLengthCap];
42 // Functions to map from device data to standard layout, if available. May
43 // be null if no mapping is available.
44 GamepadStandardMappingFunction mappers_[blink::WebGamepads::itemsLengthCap];
46 // Data that's returned to the consumer.
47 blink::WebGamepads data_;
49 scoped_ptr<UdevLinux> udev_;
51 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherLinux);
54 } // namespace content
56 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_