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

Side by Side Diff: ui/events/devices/device_data_manager.h

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ 5 #ifndef UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_
6 #define UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ 6 #define UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <array> 10 #include <array>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 void UpdateTouchRadiusScale(int touch_device_id, double scale); 52 void UpdateTouchRadiusScale(int touch_device_id, double scale);
53 void ApplyTouchRadiusScale(int touch_device_id, double* radius); 53 void ApplyTouchRadiusScale(int touch_device_id, double* radius);
54 54
55 void SetTouchscreensEnabled(bool enabled); 55 void SetTouchscreensEnabled(bool enabled);
56 56
57 // InputDeviceManager: 57 // InputDeviceManager:
58 const std::vector<TouchscreenDevice>& GetTouchscreenDevices() const override; 58 const std::vector<TouchscreenDevice>& GetTouchscreenDevices() const override;
59 const std::vector<InputDevice>& GetKeyboardDevices() const override; 59 const std::vector<InputDevice>& GetKeyboardDevices() const override;
60 const std::vector<InputDevice>& GetMouseDevices() const override; 60 const std::vector<InputDevice>& GetMouseDevices() const override;
61 const std::vector<InputDevice>& GetTouchpadDevices() const override; 61 const std::vector<InputDevice>& GetTouchpadDevices() const override;
62 const std::vector<InputDevice>& GetGamepadDevices() const override;
62 bool AreDeviceListsComplete() const override; 63 bool AreDeviceListsComplete() const override;
63 bool AreTouchscreensEnabled() const override; 64 bool AreTouchscreensEnabled() const override;
64 65
65 void AddObserver(InputDeviceEventObserver* observer) override; 66 void AddObserver(InputDeviceEventObserver* observer) override;
66 void RemoveObserver(InputDeviceEventObserver* observer) override; 67 void RemoveObserver(InputDeviceEventObserver* observer) override;
67 68
68 protected: 69 protected:
69 DeviceDataManager(); 70 DeviceDataManager();
70 71
71 static DeviceDataManager* instance(); 72 static DeviceDataManager* instance();
72 73
73 static void set_instance(DeviceDataManager* instance); 74 static void set_instance(DeviceDataManager* instance);
74 75
75 // DeviceHotplugEventObserver: 76 // DeviceHotplugEventObserver:
76 void OnTouchscreenDevicesUpdated( 77 void OnTouchscreenDevicesUpdated(
77 const std::vector<TouchscreenDevice>& devices) override; 78 const std::vector<TouchscreenDevice>& devices) override;
78 void OnKeyboardDevicesUpdated( 79 void OnKeyboardDevicesUpdated(
79 const std::vector<InputDevice>& devices) override; 80 const std::vector<InputDevice>& devices) override;
80 void OnMouseDevicesUpdated( 81 void OnMouseDevicesUpdated(
81 const std::vector<InputDevice>& devices) override; 82 const std::vector<InputDevice>& devices) override;
82 void OnTouchpadDevicesUpdated( 83 void OnTouchpadDevicesUpdated(
83 const std::vector<InputDevice>& devices) override; 84 const std::vector<InputDevice>& devices) override;
85 void OnGamepadDevicesUpdated(
86 const std::vector<InputDevice>& devices) override;
84 void OnDeviceListsComplete() override; 87 void OnDeviceListsComplete() override;
85 void OnStylusStateChanged(StylusState state) override; 88 void OnStylusStateChanged(StylusState state) override;
86 89
87 private: 90 private:
88 // Information related to a touchscreen device. 91 // Information related to a touchscreen device.
89 struct TouchscreenInfo { 92 struct TouchscreenInfo {
90 TouchscreenInfo(); 93 TouchscreenInfo();
91 void Reset(); 94 void Reset();
92 95
93 double radius_scale; 96 double radius_scale;
94 int64_t target_display; 97 int64_t target_display;
95 gfx::Transform device_transform; 98 gfx::Transform device_transform;
96 }; 99 };
97 100
98 friend class test::DeviceDataManagerTestAPI; 101 friend class test::DeviceDataManagerTestAPI;
99 102
100 static DeviceDataManager* instance_; 103 static DeviceDataManager* instance_;
101 104
102 bool IsTouchDeviceIdValid(int touch_device_id) const; 105 bool IsTouchDeviceIdValid(int touch_device_id) const;
103 106
104 void NotifyObserversTouchscreenDeviceConfigurationChanged(); 107 void NotifyObserversTouchscreenDeviceConfigurationChanged();
105 void NotifyObserversKeyboardDeviceConfigurationChanged(); 108 void NotifyObserversKeyboardDeviceConfigurationChanged();
106 void NotifyObserversMouseDeviceConfigurationChanged(); 109 void NotifyObserversMouseDeviceConfigurationChanged();
107 void NotifyObserversTouchpadDeviceConfigurationChanged(); 110 void NotifyObserversTouchpadDeviceConfigurationChanged();
111 void NotifyObserversGamepadDeviceConfigurationChanged();
108 void NotifyObserversDeviceListsComplete(); 112 void NotifyObserversDeviceListsComplete();
109 void NotifyObserversStylusStateChanged(StylusState stylus_state); 113 void NotifyObserversStylusStateChanged(StylusState stylus_state);
110 114
111 std::vector<TouchscreenDevice> touchscreen_devices_; 115 std::vector<TouchscreenDevice> touchscreen_devices_;
112 std::vector<InputDevice> keyboard_devices_; 116 std::vector<InputDevice> keyboard_devices_;
113 std::vector<InputDevice> mouse_devices_; 117 std::vector<InputDevice> mouse_devices_;
114 std::vector<InputDevice> touchpad_devices_; 118 std::vector<InputDevice> touchpad_devices_;
119 std::vector<InputDevice> gamepad_devices_;
115 bool device_lists_complete_ = false; 120 bool device_lists_complete_ = false;
116 121
117 base::ObserverList<InputDeviceEventObserver> observers_; 122 base::ObserverList<InputDeviceEventObserver> observers_;
118 123
119 bool touch_screens_enabled_ = true; 124 bool touch_screens_enabled_ = true;
120 125
121 // Contains touchscreen device info for each device mapped by device ID. Will 126 // Contains touchscreen device info for each device mapped by device ID. Will
122 // have default values if the device with corresponding ID isn't a touchscreen 127 // have default values if the device with corresponding ID isn't a touchscreen
123 // or doesn't exist. 128 // or doesn't exist.
124 std::array<TouchscreenInfo, kMaxDeviceNum> touch_map_; 129 std::array<TouchscreenInfo, kMaxDeviceNum> touch_map_;
125 130
126 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); 131 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
127 }; 132 };
128 133
129 } // namespace ui 134 } // namespace ui
130 135
131 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ 136 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/events/BUILD.gn ('k') | ui/events/devices/device_data_manager.cc » ('j') | ui/events/event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698