Index: ui/events/device_data_manager.cc |
diff --git a/ui/events/device_data_manager.cc b/ui/events/device_data_manager.cc |
index d255b871abc80b10082d7408e92e25deafc7cb9a..fd9989c386826912c24c00f5922cda1d2e0359fa 100644 |
--- a/ui/events/device_data_manager.cc |
+++ b/ui/events/device_data_manager.cc |
@@ -13,6 +13,15 @@ |
namespace ui { |
+namespace { |
+ |
+bool InputDeviceEquals(const ui::InputDevice& a, |
+ const ui::InputDevice& b) { |
sky
2014/10/20 22:18:43
Make sure you run git cl format (this looks weird,
rsadam
2014/10/21 16:53:52
Done.
|
+ return a.id == b.id; |
+} |
+ |
+} // namespace |
+ |
// static |
DeviceDataManager* DeviceDataManager::instance_ = NULL; |
@@ -111,11 +120,28 @@ int64_t DeviceDataManager::GetDisplayForTouchDevice(int touch_device_id) const { |
void DeviceDataManager::OnTouchscreenDevicesUpdated( |
const std::vector<TouchscreenDevice>& devices) { |
+ if (devices.size() == touchscreen_devices_.size() && |
sky
2014/10/20 22:18:43
Doesn't std::equals handle the length check?
rsadam
2014/10/21 16:53:52
Removing this line causes a segfault. I did some d
|
+ std::equal(devices.begin(), devices.end(), |
+ touchscreen_devices_.begin(), InputDeviceEquals)) { |
+ return; |
+ } |
touchscreen_devices_ = devices; |
+ FOR_EACH_OBSERVER(InputDeviceEventObserver, |
+ observers_, |
sky
2014/10/20 22:18:43
same comment about git cl format here and 143, spa
rsadam
2014/10/21 16:53:52
Done.
|
+ OnTouchscreenDeviceConfigurationChanged()); |
+} |
+void DeviceDataManager::OnKeyboardDevicesUpdated( |
+ const std::vector<KeyboardDevice>& devices) { |
+ if (devices.size() == keyboard_devices_.size() && |
sky
2014/10/20 22:18:43
Same comment here about equals.
rsadam
2014/10/21 16:53:52
Please see above.
|
+ std::equal(devices.begin(), devices.end(), |
+ keyboard_devices_.begin(), InputDeviceEquals)) { |
+ return; |
+ } |
+ keyboard_devices_ = devices; |
FOR_EACH_OBSERVER(InputDeviceEventObserver, |
- observers_, |
- OnInputDeviceConfigurationChanged()); |
+ observers_, |
+ OnKeyboardDeviceConfigurationChanged()); |
} |
void DeviceDataManager::AddObserver(InputDeviceEventObserver* observer) { |