OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/event_utils.h" | 5 #include "ui/events/event_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ui/display/display.h" | 9 #include "ui/display/display.h" |
10 #include "ui/display/screen.h" | 10 #include "ui/display/screen.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 default: | 53 default: |
54 break; | 54 break; |
55 } | 55 } |
56 return event; | 56 return event; |
57 } | 57 } |
58 | 58 |
59 int RegisterCustomEventType() { | 59 int RegisterCustomEventType() { |
60 return ++g_custom_event_types; | 60 return ++g_custom_event_types; |
61 } | 61 } |
62 | 62 |
63 base::TimeDelta EventTimeForNow() { | 63 base::TimeTicks EventTimeForNow() { |
64 return base::TimeDelta::FromInternalValue( | 64 return base::TimeTicks::Now(); |
65 base::TimeTicks::Now().ToInternalValue()); | |
66 } | 65 } |
67 | 66 |
68 bool ShouldDefaultToNaturalScroll() { | 67 bool ShouldDefaultToNaturalScroll() { |
69 return GetInternalDisplayTouchSupport() == | 68 return GetInternalDisplayTouchSupport() == |
70 display::Display::TOUCH_SUPPORT_AVAILABLE; | 69 display::Display::TOUCH_SUPPORT_AVAILABLE; |
71 } | 70 } |
72 | 71 |
73 display::Display::TouchSupport GetInternalDisplayTouchSupport() { | 72 display::Display::TouchSupport GetInternalDisplayTouchSupport() { |
74 display::Screen* screen = display::Screen::GetScreen(); | 73 display::Screen* screen = display::Screen::GetScreen(); |
75 // No screen in some unit tests. | 74 // No screen in some unit tests. |
76 if (!screen) | 75 if (!screen) |
77 return display::Display::TOUCH_SUPPORT_UNKNOWN; | 76 return display::Display::TOUCH_SUPPORT_UNKNOWN; |
78 const std::vector<display::Display>& displays = screen->GetAllDisplays(); | 77 const std::vector<display::Display>& displays = screen->GetAllDisplays(); |
79 for (std::vector<display::Display>::const_iterator it = displays.begin(); | 78 for (std::vector<display::Display>::const_iterator it = displays.begin(); |
80 it != displays.end(); ++it) { | 79 it != displays.end(); ++it) { |
81 if (it->IsInternal()) | 80 if (it->IsInternal()) |
82 return it->touch_support(); | 81 return it->touch_support(); |
83 } | 82 } |
84 return display::Display::TOUCH_SUPPORT_UNAVAILABLE; | 83 return display::Display::TOUCH_SUPPORT_UNAVAILABLE; |
85 } | 84 } |
86 | 85 |
87 } // namespace ui | 86 } // namespace ui |
OLD | NEW |