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

Side by Side Diff: ui/base/touch/touch_device_ozone.cc

Issue 815983003: Unified touch_device_aurax11 and touch_device_ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « ui/base/touch/touch_device_linux.cc ('k') | ui/base/ui_base.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/base/touch/touch_device.h"
6
7 #include "base/logging.h"
8 #include "ui/events/devices/device_data_manager.h"
9
10 namespace ui {
11
12 bool IsTouchDevicePresent() {
13 // TODO(sadrul@chromium.org): Support evdev hotplugging.
14 return ui::DeviceDataManager::GetInstance()->touchscreen_devices().size() > 0;
15 }
16
17 int MaxTouchPoints() {
18 // Hard-code this to 11 until we have a real implementation.
19 return 11;
20 }
21
22 // TODO(mustaq@chromium.org): Use mouse detection logic. crbug.com/440503
23 int GetAvailablePointerTypes() {
24 // Assume a mouse is there
25 int available_pointer_types = POINTER_TYPE_FINE;
26 if (IsTouchDevicePresent())
27 available_pointer_types |= POINTER_TYPE_COARSE;
28
29 DCHECK(available_pointer_types);
30 return available_pointer_types;
31 }
32
33 PointerType GetPrimaryPointerType() {
34 int available_pointer_types = GetAvailablePointerTypes();
35 if (available_pointer_types & POINTER_TYPE_FINE)
36 return POINTER_TYPE_FINE;
37 if (available_pointer_types & POINTER_TYPE_COARSE)
38 return POINTER_TYPE_COARSE;
39 DCHECK_EQ(available_pointer_types, POINTER_TYPE_NONE);
40 return POINTER_TYPE_NONE;
41 }
42
43 // TODO(mustaq@chromium.org): Use mouse detection logic. crbug.com/440503
44 int GetAvailableHoverTypes() {
45 // Assume a mouse is there
46 int available_hover_types = HOVER_TYPE_HOVER;
47 if (IsTouchDevicePresent())
48 available_hover_types |= HOVER_TYPE_ON_DEMAND;
49
50 DCHECK(available_hover_types);
51 return available_hover_types;
52 }
53
54 HoverType GetPrimaryHoverType() {
55 int available_hover_types = GetAvailableHoverTypes();
56 if (available_hover_types & HOVER_TYPE_HOVER)
57 return HOVER_TYPE_HOVER;
58 if (available_hover_types & HOVER_TYPE_ON_DEMAND)
59 return HOVER_TYPE_ON_DEMAND;
60 DCHECK_EQ(available_hover_types, HOVER_TYPE_NONE);
61 return HOVER_TYPE_NONE;
62 }
63
64 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/touch/touch_device_linux.cc ('k') | ui/base/ui_base.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698