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

Unified Diff: ui/events/device_data_manager.cc

Issue 618283003: Adds special support to the device manager for keyboards devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change in ozone. Created 6 years, 2 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/device_data_manager.cc
diff --git a/ui/events/device_data_manager.cc b/ui/events/device_data_manager.cc
index d255b871abc80b10082d7408e92e25deafc7cb9a..6c5e6eba08641a1455aed89fbda0a08427583c42 100644
--- a/ui/events/device_data_manager.cc
+++ b/ui/events/device_data_manager.cc
@@ -13,6 +13,20 @@
namespace ui {
+namespace {
+
+bool TouchscreenEquals(const ui::TouchscreenDevice& a,
+ const ui::TouchscreenDevice& b) {
+ return a.id == b.id;
+}
+
+bool KeyboardEquals(const ui::KeyboardDevice& a,
+ const ui::KeyboardDevice& b) {
+ return a.id == b.id;
+}
flackr 2014/10/06 18:31:11 Can this not be done with a single InputDeviceEqua
rsadam 2014/10/06 19:38:01 Done.
+
+} // namespace
+
// static
DeviceDataManager* DeviceDataManager::instance_ = NULL;
@@ -111,11 +125,28 @@ int64_t DeviceDataManager::GetDisplayForTouchDevice(int touch_device_id) const {
void DeviceDataManager::OnTouchscreenDevicesUpdated(
const std::vector<TouchscreenDevice>& devices) {
+ if (devices.size() == touchscreen_devices_.size() &&
+ std::equal(devices.begin(), devices.end(),
+ touchscreen_devices_.begin(), TouchscreenEquals)) {
+ return;
+ }
touchscreen_devices_ = devices;
+ FOR_EACH_OBSERVER(InputDeviceEventObserver,
+ observers_,
+ OnTouchscreenDeviceConfigurationChanged());
+}
+void DeviceDataManager::OnKeyboardDevicesUpdated(
+ const std::vector<KeyboardDevice>& devices) {
+ if (devices.size() == keyboard_devices_.size() &&
+ std::equal(devices.begin(), devices.end(),
+ keyboard_devices_.begin(), KeyboardEquals)) {
+ return;
+ }
+ keyboard_devices_ = devices;
FOR_EACH_OBSERVER(InputDeviceEventObserver,
- observers_,
- OnInputDeviceConfigurationChanged());
+ observers_,
+ OnKeyboardDeviceConfigurationChanged());
}
void DeviceDataManager::AddObserver(InputDeviceEventObserver* observer) {

Powered by Google App Engine
This is Rietveld 408576698