| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/base/touch/touch_device.h" | 5 #include "ui/base/touch/touch_device.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/events/devices/device_data_manager.h" | 8 #include "ui/events/devices/input_device_manager.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 bool IsTouchDevicePresent() { | 14 bool IsTouchDevicePresent() { |
| 15 return !DeviceDataManager::GetInstance()->touchscreen_devices().empty(); | 15 return !InputDeviceManager::GetInstance()->touchscreen_devices().empty(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 TouchScreensAvailability GetTouchScreensAvailability() { | 20 TouchScreensAvailability GetTouchScreensAvailability() { |
| 21 if (!IsTouchDevicePresent()) | 21 if (!IsTouchDevicePresent()) |
| 22 return TouchScreensAvailability::NONE; | 22 return TouchScreensAvailability::NONE; |
| 23 | 23 |
| 24 return DeviceDataManager::GetInstance()->AreTouchscreensEnabled() ? | 24 return InputDeviceManager::GetInstance()->AreTouchscreensEnabled() |
| 25 TouchScreensAvailability::ENABLED : | 25 ? TouchScreensAvailability::ENABLED |
| 26 TouchScreensAvailability::DISABLED; | 26 : TouchScreensAvailability::DISABLED; |
| 27 } | 27 } |
| 28 | 28 |
| 29 int MaxTouchPoints() { | 29 int MaxTouchPoints() { |
| 30 int max_touch = 0; | 30 int max_touch = 0; |
| 31 const std::vector<ui::TouchscreenDevice>& touchscreen_devices = | 31 const std::vector<ui::TouchscreenDevice>& touchscreen_devices = |
| 32 ui::DeviceDataManager::GetInstance()->touchscreen_devices(); | 32 ui::InputDeviceManager::GetInstance()->touchscreen_devices(); |
| 33 for (const ui::TouchscreenDevice& device : touchscreen_devices) { | 33 for (const ui::TouchscreenDevice& device : touchscreen_devices) { |
| 34 if (device.touch_points > max_touch) | 34 if (device.touch_points > max_touch) |
| 35 max_touch = device.touch_points; | 35 max_touch = device.touch_points; |
| 36 } | 36 } |
| 37 return max_touch; | 37 return max_touch; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // TODO(mustaq@chromium.org): Use mouse detection logic. crbug.com/495634 | 40 // TODO(mustaq@chromium.org): Use mouse detection logic. crbug.com/495634 |
| 41 int GetAvailablePointerTypes() { | 41 int GetAvailablePointerTypes() { |
| 42 // Assume a mouse is there | 42 // Assume a mouse is there |
| (...skipping 30 matching lines...) Expand all Loading... |
| 73 int available_hover_types = GetAvailableHoverTypes(); | 73 int available_hover_types = GetAvailableHoverTypes(); |
| 74 if (available_hover_types & HOVER_TYPE_HOVER) | 74 if (available_hover_types & HOVER_TYPE_HOVER) |
| 75 return HOVER_TYPE_HOVER; | 75 return HOVER_TYPE_HOVER; |
| 76 if (available_hover_types & HOVER_TYPE_ON_DEMAND) | 76 if (available_hover_types & HOVER_TYPE_ON_DEMAND) |
| 77 return HOVER_TYPE_ON_DEMAND; | 77 return HOVER_TYPE_ON_DEMAND; |
| 78 DCHECK_EQ(available_hover_types, HOVER_TYPE_NONE); | 78 DCHECK_EQ(available_hover_types, HOVER_TYPE_NONE); |
| 79 return HOVER_TYPE_NONE; | 79 return HOVER_TYPE_NONE; |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace ui | 82 } // namespace ui |
| OLD | NEW |