Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: content/browser/gamepad/gamepad_platform_data_fetcher_linux.h

Issue 1627643002: Revert of Refactoring gamepad polling to support dynamically added sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_ 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_
7 7
8 #include <stddef.h>
9
10 #include <string>
11
12 #include "base/compiler_specific.h"
8 #include "base/macros.h" 13 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
10 #include "content/browser/gamepad/gamepad_data_fetcher.h" 15 #include "content/browser/gamepad/gamepad_data_fetcher.h"
11 16
12 extern "C" { 17 extern "C" {
13 struct udev_device; 18 struct udev_device;
14 } 19 }
15 20
16 namespace content { 21 namespace content {
17 22
18 class UdevLinux; 23 class UdevLinux;
19 24
20 class GamepadPlatformDataFetcherLinux : public GamepadDataFetcher { 25 class GamepadPlatformDataFetcherLinux : public GamepadDataFetcher {
21 public: 26 public:
22 GamepadPlatformDataFetcherLinux(); 27 GamepadPlatformDataFetcherLinux();
23 ~GamepadPlatformDataFetcherLinux() override; 28 ~GamepadPlatformDataFetcherLinux() override;
24 29
25 // GamepadDataFetcher implementation. 30 // GamepadDataFetcher implementation.
26 void GetGamepadData(bool devices_changed_hint) override; 31 void GetGamepadData(blink::WebGamepads* pads,
32 bool devices_changed_hint) override;
27 33
28 private: 34 private:
29 void OnAddedToProvider() override;
30
31 void RefreshDevice(udev_device* dev); 35 void RefreshDevice(udev_device* dev);
32 void EnumerateDevices(); 36 void EnumerateDevices();
33 void ReadDeviceData(size_t index); 37 void ReadDeviceData(size_t index);
34 38
35 // File descriptor for the /dev/input/js* devices. -1 if not in use. 39 // File descriptor for the /dev/input/js* devices. -1 if not in use.
36 int device_fd_[blink::WebGamepads::itemsLengthCap]; 40 int device_fd_[blink::WebGamepads::itemsLengthCap];
37 41
38 scoped_ptr<UdevLinux> udev_; 42 scoped_ptr<UdevLinux> udev_;
39 43
40 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherLinux); 44 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherLinux);
41 }; 45 };
42 46
43 } // namespace content 47 } // namespace content
44 48
45 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_ 49 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698