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

Unified Diff: ui/events/devices/device_data_manager.cc

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 side-by-side diff with in-line comments
Download patch
Index: ui/events/devices/device_data_manager.cc
diff --git a/ui/events/devices/device_data_manager.cc b/ui/events/devices/device_data_manager.cc
index 38a184cf91c40a18ddfa533b055dac5aba3fa4b9..9f0fe8eb2a01b660d091751b37a6a2006ad22fbe 100644
--- a/ui/events/devices/device_data_manager.cc
+++ b/ui/events/devices/device_data_manager.cc
@@ -151,6 +151,10 @@ const std::vector<InputDevice>& DeviceDataManager::GetTouchpadDevices() const {
return touchpad_devices_;
}
+const std::vector<InputDevice>& DeviceDataManager::GetGamepadDevices() const {
+ return gamepad_devices_;
+}
+
bool DeviceDataManager::AreDeviceListsComplete() const {
return device_lists_complete_;
}
@@ -214,6 +218,17 @@ void DeviceDataManager::OnTouchpadDevicesUpdated(
NotifyObserversTouchpadDeviceConfigurationChanged();
}
+void DeviceDataManager::OnGamepadDevicesUpdated(
+ const std::vector<InputDevice>& devices) {
+ if (devices.size() == gamepad_devices_.size() &&
+ std::equal(devices.begin(), devices.end(), gamepad_devices_.begin(),
+ InputDeviceEquals)) {
+ return;
+ }
+ gamepad_devices_ = devices;
+ NotifyObserversGamepadDeviceConfigurationChanged();
+}
+
void DeviceDataManager::OnDeviceListsComplete() {
if (!device_lists_complete_) {
device_lists_complete_ = true;
@@ -237,6 +252,9 @@ NOTIFY_OBSERVERS(NotifyObserversMouseDeviceConfigurationChanged(),
NOTIFY_OBSERVERS(NotifyObserversTouchpadDeviceConfigurationChanged(),
OnTouchpadDeviceConfigurationChanged());
+NOTIFY_OBSERVERS(NotifyObserversGamepadDeviceConfigurationChanged(),
+ OnGamepadDeviceConfigurationChanged());
+
NOTIFY_OBSERVERS(NotifyObserversDeviceListsComplete(), OnDeviceListsComplete());
NOTIFY_OBSERVERS(NotifyObserversStylusStateChanged(StylusState state),

Powered by Google App Engine
This is Rietveld 408576698