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/gfx/display.h" | 9 #include "ui/gfx/display.h" |
10 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return base::TimeDelta::FromInternalValue( | 64 return base::TimeDelta::FromInternalValue( |
65 base::TimeTicks::Now().ToInternalValue()); | 65 base::TimeTicks::Now().ToInternalValue()); |
66 } | 66 } |
67 | 67 |
68 bool ShouldDefaultToNaturalScroll() { | 68 bool ShouldDefaultToNaturalScroll() { |
69 return GetInternalDisplayTouchSupport() == | 69 return GetInternalDisplayTouchSupport() == |
70 gfx::Display::TOUCH_SUPPORT_AVAILABLE; | 70 gfx::Display::TOUCH_SUPPORT_AVAILABLE; |
71 } | 71 } |
72 | 72 |
73 gfx::Display::TouchSupport GetInternalDisplayTouchSupport() { | 73 gfx::Display::TouchSupport GetInternalDisplayTouchSupport() { |
74 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); | 74 gfx::Screen* screen = gfx::Screen::GetScreen(); |
75 // No screen in some unit tests. | 75 // No screen in some unit tests. |
76 if (!screen) | 76 if (!screen) |
77 return gfx::Display::TOUCH_SUPPORT_UNKNOWN; | 77 return gfx::Display::TOUCH_SUPPORT_UNKNOWN; |
78 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); | 78 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); |
79 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); | 79 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); |
80 it != displays.end(); ++it) { | 80 it != displays.end(); ++it) { |
81 if (it->IsInternal()) | 81 if (it->IsInternal()) |
82 return it->touch_support(); | 82 return it->touch_support(); |
83 } | 83 } |
84 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE; | 84 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE; |
85 } | 85 } |
86 | 86 |
87 } // namespace ui | 87 } // namespace ui |
OLD | NEW |