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

Side by Side Diff: ui/events/ozone/gamepad/gamepad_provider_ozone.h

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: Support Gamepad in Ozone. Created 3 years, 8 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
(Empty)
1 // Copyright 2017 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 UI_EVENTS_OZONE_GAMEPAD_GAMEPAD_PROVIDER_OZONE_H_
6 #define UI_EVENTS_OZONE_GAMEPAD_GAMEPAD_PROVIDER_OZONE_H_
7
8 #include <set>
9 #include <vector>
10 #include "base/macros.h"
11 #include "base/time/time.h"
12 #include "ui/events/devices/input_device.h"
13 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
14 #include "ui/events/ozone/gamepad/gamepad_observer.h"
15
16 namespace base {
17 template <typename T>
18 struct DefaultSingletonTraits;
19 }
20
21 namespace ui {
22
23 class EVENTS_OZONE_EVDEV_EXPORT GamepadProviderOzone {
24 public:
25 // Get the GamepadProviderOzone instance.
26 static GamepadProviderOzone* GetInstance();
spang 2017/04/21 05:38:47 Can you get this through the existing OzonePlatfor
jkwang 2017/04/25 21:16:41 Will this result in a circular dependency? ui/ozon
27
28 // Dispatch GamepadDevicesUpdate event when gamepad device is connected or
29 // disconnected. This function must be called on UI thread.
30 void DispatchGamepadDevicesUpdated(std::vector<InputDevice> gamepad_devices);
31
32 // Dispatch button event when gamepad event is seen.
33 // Code is the index of gamepad button or gamepad axis defined in W3C standard
34 // gamepad.
35 // This function must be called on UI thread.
36 void DispatchGamepadEvent(const GamepadEvent& event);
37
38 // Add observer to gamepad provider. This function must be called on UI
39 // thread.
40 void AddGamepadObserver(GamepadObserver* observer);
41
42 // Remove observer from gamepad provider. This function must be called on UI
43 // thread.
44 void RemoveGamepadObserver(GamepadObserver* observer);
45
46 // Get the list of currently connected gamepad devices. This function must be
47 // called on UI thread.
48 std::vector<InputDevice> GetGamepadDevices();
49
50 private:
51 GamepadProviderOzone();
52
53 ~GamepadProviderOzone();
54
55 // Make SingletonTraits friend to enable singleton.
56 friend struct base::DefaultSingletonTraits<GamepadProviderOzone>;
57
58 // Registered observers will receive gamepad device update event and gamepad
59 // event.
60 std::set<GamepadObserver*> observers_;
spang 2017/04/21 05:38:47 set is a binary search tree; this is overkill. Jus
jkwang 2017/04/25 21:16:41 Done.
61
62 // List of current connected gamepad events.
63 std::vector<InputDevice> gamepad_devices_;
64
65 DISALLOW_COPY_AND_ASSIGN(GamepadProviderOzone);
66 };
67
68 } // namespace ui
69
70 #endif // UI_EVENTS_OZONE_GAMEPAD_GAMEPAD_PROVIDER_OZONE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698