Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "ui/events/devices/device_data_manager.h" | 5 #include "ui/events/devices/device_data_manager.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/display/types/display_constants.h" | 10 #include "ui/display/types/display_constants.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 | 157 |
| 158 int64_t DeviceDataManager::GetTargetDisplayForTouchDevice( | 158 int64_t DeviceDataManager::GetTargetDisplayForTouchDevice( |
| 159 int touch_device_id) const { | 159 int touch_device_id) const { |
| 160 if (IsTouchDeviceIdValid(touch_device_id)) | 160 if (IsTouchDeviceIdValid(touch_device_id)) |
| 161 return touch_map_[touch_device_id].target_display; | 161 return touch_map_[touch_device_id].target_display; |
| 162 return display::kInvalidDisplayId; | 162 return display::kInvalidDisplayId; |
| 163 } | 163 } |
| 164 | 164 |
| 165 void DeviceDataManager::OnTouchscreenDevicesUpdated( | 165 void DeviceDataManager::OnTouchscreenDevicesUpdated( |
| 166 const std::vector<TouchscreenDevice>& devices) { | 166 const std::vector<TouchscreenDevice>& devices) { |
| 167 LOG(ERROR) << "mDebug " << __FUNCTION__; | |
|
mustaq
2017/03/21 17:53:07
Please remove the debug logs.
| |
| 167 if (devices.size() == touchscreen_devices_.size() && | 168 if (devices.size() == touchscreen_devices_.size() && |
| 168 std::equal(devices.begin(), | 169 std::equal(devices.begin(), |
| 169 devices.end(), | 170 devices.end(), |
| 170 touchscreen_devices_.begin(), | 171 touchscreen_devices_.begin(), |
| 171 InputDeviceEquals)) { | 172 InputDeviceEquals)) { |
| 172 return; | 173 return; |
| 173 } | 174 } |
| 174 touchscreen_devices_ = devices; | 175 touchscreen_devices_ = devices; |
| 175 NotifyObserversTouchscreenDeviceConfigurationChanged(); | 176 NotifyObserversTouchscreenDeviceConfigurationChanged(); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void DeviceDataManager::OnKeyboardDevicesUpdated( | 179 void DeviceDataManager::OnKeyboardDevicesUpdated( |
| 179 const std::vector<InputDevice>& devices) { | 180 const std::vector<InputDevice>& devices) { |
| 181 LOG(ERROR) << "mDebug " << __FUNCTION__; | |
| 180 if (devices.size() == keyboard_devices_.size() && | 182 if (devices.size() == keyboard_devices_.size() && |
| 181 std::equal(devices.begin(), | 183 std::equal(devices.begin(), |
| 182 devices.end(), | 184 devices.end(), |
| 183 keyboard_devices_.begin(), | 185 keyboard_devices_.begin(), |
| 184 InputDeviceEquals)) { | 186 InputDeviceEquals)) { |
| 185 return; | 187 return; |
| 186 } | 188 } |
| 187 keyboard_devices_ = devices; | 189 keyboard_devices_ = devices; |
| 188 NotifyObserversKeyboardDeviceConfigurationChanged(); | 190 NotifyObserversKeyboardDeviceConfigurationChanged(); |
| 189 } | 191 } |
| 190 | 192 |
| 191 void DeviceDataManager::OnMouseDevicesUpdated( | 193 void DeviceDataManager::OnMouseDevicesUpdated( |
| 192 const std::vector<InputDevice>& devices) { | 194 const std::vector<InputDevice>& devices) { |
| 195 LOG(ERROR) << "mDebug " << __FUNCTION__; | |
| 193 if (devices.size() == mouse_devices_.size() && | 196 if (devices.size() == mouse_devices_.size() && |
| 194 std::equal(devices.begin(), | 197 std::equal(devices.begin(), |
| 195 devices.end(), | 198 devices.end(), |
| 196 mouse_devices_.begin(), | 199 mouse_devices_.begin(), |
| 197 InputDeviceEquals)) { | 200 InputDeviceEquals)) { |
| 198 return; | 201 return; |
| 199 } | 202 } |
| 200 mouse_devices_ = devices; | 203 mouse_devices_ = devices; |
| 201 NotifyObserversMouseDeviceConfigurationChanged(); | 204 NotifyObserversMouseDeviceConfigurationChanged(); |
| 202 } | 205 } |
| 203 | 206 |
| 204 void DeviceDataManager::OnTouchpadDevicesUpdated( | 207 void DeviceDataManager::OnTouchpadDevicesUpdated( |
| 205 const std::vector<InputDevice>& devices) { | 208 const std::vector<InputDevice>& devices) { |
| 209 LOG(ERROR) << "mDebug " << __FUNCTION__; | |
| 206 if (devices.size() == touchpad_devices_.size() && | 210 if (devices.size() == touchpad_devices_.size() && |
| 207 std::equal(devices.begin(), | 211 std::equal(devices.begin(), |
| 208 devices.end(), | 212 devices.end(), |
| 209 touchpad_devices_.begin(), | 213 touchpad_devices_.begin(), |
| 210 InputDeviceEquals)) { | 214 InputDeviceEquals)) { |
| 211 return; | 215 return; |
| 212 } | 216 } |
| 213 touchpad_devices_ = devices; | 217 touchpad_devices_ = devices; |
| 214 NotifyObserversTouchpadDeviceConfigurationChanged(); | 218 NotifyObserversTouchpadDeviceConfigurationChanged(); |
| 215 } | 219 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 | 256 |
| 253 void DeviceDataManager::SetTouchscreensEnabled(bool enabled) { | 257 void DeviceDataManager::SetTouchscreensEnabled(bool enabled) { |
| 254 touch_screens_enabled_ = enabled; | 258 touch_screens_enabled_ = enabled; |
| 255 } | 259 } |
| 256 | 260 |
| 257 bool DeviceDataManager::AreTouchscreensEnabled() const { | 261 bool DeviceDataManager::AreTouchscreensEnabled() const { |
| 258 return touch_screens_enabled_; | 262 return touch_screens_enabled_; |
| 259 } | 263 } |
| 260 | 264 |
| 261 } // namespace ui | 265 } // namespace ui |
| OLD | NEW |