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/device_data_manager.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 bool IsTouchDevicePresent() { | 12 bool IsTouchDevicePresent() { |
13 // TODO(sadrul@chromium.org): Support evdev hotplugging. | |
sadrul
2015/01/15 22:07:50
We don't need this TODO anymore. You can remove th
mustaq
2015/01/20 15:03:50
Done.
| |
13 return ui::DeviceDataManager::GetInstance()->touchscreen_devices().size() > 0; | 14 return ui::DeviceDataManager::GetInstance()->touchscreen_devices().size() > 0; |
14 } | 15 } |
15 | 16 |
16 int MaxTouchPoints() { | 17 int MaxTouchPoints() { |
17 int max_touch = -1; | 18 int max_touch = 0; |
18 const std::vector<ui::TouchscreenDevice>& touchscreen_devices = | 19 const std::vector<ui::TouchscreenDevice>& touchscreen_devices = |
19 ui::DeviceDataManager::GetInstance()->touchscreen_devices(); | 20 ui::DeviceDataManager::GetInstance()->touchscreen_devices(); |
20 for (const ui::TouchscreenDevice& device : touchscreen_devices) { | 21 for (const ui::TouchscreenDevice& device : touchscreen_devices) { |
21 if (device.touch_points > max_touch) | 22 if (device.touch_points > max_touch) |
22 max_touch = device.touch_points; | 23 max_touch = device.touch_points; |
23 } | 24 } |
24 return max_touch; | 25 return max_touch; |
25 } | 26 } |
26 | 27 |
27 // TODO(mustaq@chromium.org): Use mouse detection logic. crbug.com/440503 | 28 // TODO(mustaq@chromium.org): Use mouse detection logic. crbug.com/440503 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 int available_hover_types = GetAvailableHoverTypes(); | 61 int available_hover_types = GetAvailableHoverTypes(); |
61 if (available_hover_types & HOVER_TYPE_HOVER) | 62 if (available_hover_types & HOVER_TYPE_HOVER) |
62 return HOVER_TYPE_HOVER; | 63 return HOVER_TYPE_HOVER; |
63 if (available_hover_types & HOVER_TYPE_ON_DEMAND) | 64 if (available_hover_types & HOVER_TYPE_ON_DEMAND) |
64 return HOVER_TYPE_ON_DEMAND; | 65 return HOVER_TYPE_ON_DEMAND; |
65 DCHECK_EQ(available_hover_types, HOVER_TYPE_NONE); | 66 DCHECK_EQ(available_hover_types, HOVER_TYPE_NONE); |
66 return HOVER_TYPE_NONE; | 67 return HOVER_TYPE_NONE; |
67 } | 68 } |
68 | 69 |
69 } // namespace ui | 70 } // namespace ui |
OLD | NEW |