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

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

Issue 1182303005: Fixed the Touchscreen.TouchEventsEnabled histogram to record the correct values on X11 and Ozone ba… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compile time issues across the failing platform builds. Created 5 years, 5 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 e725736df3923ad538e69795a0d10fd586c5e87b..8633ddf9dc513b4768c85ea6e2937e21f51b09b8 100644
--- a/ui/events/devices/device_data_manager.cc
+++ b/ui/events/devices/device_data_manager.cc
@@ -35,7 +35,8 @@ DeviceDataManager::~DeviceDataManager() {
DeviceDataManager* DeviceDataManager::instance() { return instance_; }
void DeviceDataManager::set_instance(DeviceDataManager* instance) {
- CHECK(!instance_) << "Can not set multiple instances of DeviceDataManager";
+ CHECK(!instance || !instance_)
Alexei Svitkine (slow) 2015/07/07 22:00:59 Nit: I think this should be a DCHECK().
bruthig 2015/07/08 20:29:52 Done.
+ << "Can not set multiple instances of DeviceDataManager";
sadrul 2015/07/07 22:04:39 Have separate DCHECK()s with the right message ins
bruthig 2015/07/08 20:29:52 Actually the logic is, 'instance' can be null, or
instance_ = instance;
}
@@ -46,6 +47,7 @@ void DeviceDataManager::CreateInstance() {
set_instance(new DeviceDataManager());
+ // TODO(bruthig): Replace the DeleteInstance callbacks with explicit calls.
base::AtExitManager::RegisterTask(base::Bind(DeleteInstance));
}
@@ -132,9 +134,7 @@ void DeviceDataManager::OnTouchscreenDevicesUpdated(
return;
}
touchscreen_devices_ = devices;
- FOR_EACH_OBSERVER(InputDeviceEventObserver,
- observers_,
- OnTouchscreenDeviceConfigurationChanged());
+ NotifyObserversTouchscreenDeviceConfigurationChanged();
}
void DeviceDataManager::OnKeyboardDevicesUpdated(
@@ -147,9 +147,7 @@ void DeviceDataManager::OnKeyboardDevicesUpdated(
return;
}
keyboard_devices_ = devices;
- FOR_EACH_OBSERVER(InputDeviceEventObserver,
- observers_,
- OnKeyboardDeviceConfigurationChanged());
+ NotifyObserversKeyboardDeviceConfigurationChanged();
}
void DeviceDataManager::OnMouseDevicesUpdated(
@@ -162,9 +160,7 @@ void DeviceDataManager::OnMouseDevicesUpdated(
return;
}
mouse_devices_ = devices;
- FOR_EACH_OBSERVER(InputDeviceEventObserver,
- observers_,
- OnMouseDeviceConfigurationChanged());
+ NotifyObserversMouseDeviceConfigurationChanged();
}
void DeviceDataManager::OnTouchpadDevicesUpdated(
@@ -177,17 +173,39 @@ void DeviceDataManager::OnTouchpadDevicesUpdated(
return;
}
touchpad_devices_ = devices;
- FOR_EACH_OBSERVER(InputDeviceEventObserver,
- observers_,
- OnTouchpadDeviceConfigurationChanged());
+ NotifyObserversTouchpadDeviceConfigurationChanged();
}
void DeviceDataManager::OnDeviceListsComplete() {
if (!device_lists_complete_) {
device_lists_complete_ = true;
+ NotifyObserversDeviceListsComplete();
+ }
+}
+
+void DeviceDataManager::NotifyObserversTouchscreenDeviceConfigurationChanged() {
+ FOR_EACH_OBSERVER(InputDeviceEventObserver, observers_,
+ OnTouchscreenDeviceConfigurationChanged());
+}
+
+void DeviceDataManager::NotifyObserversKeyboardDeviceConfigurationChanged() {
+ FOR_EACH_OBSERVER(InputDeviceEventObserver, observers_,
+ OnKeyboardDeviceConfigurationChanged());
+}
+
+void DeviceDataManager::NotifyObserversMouseDeviceConfigurationChanged() {
+ FOR_EACH_OBSERVER(InputDeviceEventObserver, observers_,
+ OnMouseDeviceConfigurationChanged());
+}
+
+void DeviceDataManager::NotifyObserversTouchpadDeviceConfigurationChanged() {
+ FOR_EACH_OBSERVER(InputDeviceEventObserver, observers_,
+ OnTouchpadDeviceConfigurationChanged());
+}
+
+void DeviceDataManager::NotifyObserversDeviceListsComplete() {
FOR_EACH_OBSERVER(InputDeviceEventObserver, observers_,
OnDeviceListsComplete());
- }
}
void DeviceDataManager::AddObserver(InputDeviceEventObserver* observer) {

Powered by Google App Engine
This is Rietveld 408576698