| 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/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 int RegisterCustomEventType() { | 23 int RegisterCustomEventType() { |
| 24 return ++g_custom_event_types; | 24 return ++g_custom_event_types; |
| 25 } | 25 } |
| 26 | 26 |
| 27 base::TimeDelta EventTimeForNow() { | 27 base::TimeDelta EventTimeForNow() { |
| 28 return base::TimeDelta::FromInternalValue( | 28 return base::TimeDelta::FromInternalValue( |
| 29 base::TimeTicks::Now().ToInternalValue()); | 29 base::TimeTicks::Now().ToInternalValue()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool ShouldDefaultToNaturalScroll() { | 32 bool ShouldDefaultToNaturalScroll() { |
| 33 return InternalDisplaySupportsTouch(); |
| 34 } |
| 35 |
| 36 bool InternalDisplaySupportsTouch() { |
| 33 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); | 37 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); |
| 34 if (!screen) | 38 if (!screen) |
| 35 return false; | 39 return false; |
| 36 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); | 40 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); |
| 37 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); | 41 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); |
| 38 it != displays.end(); ++it) { | 42 it != displays.end(); ++it) { |
| 39 const gfx::Display& display = *it; | 43 const gfx::Display& display = *it; |
| 40 if (display.IsInternal() && | 44 if (display.IsInternal() && |
| 41 display.touch_support() == gfx::Display::TOUCH_SUPPORT_AVAILABLE) | 45 display.touch_support() == gfx::Display::TOUCH_SUPPORT_AVAILABLE) |
| 42 return true; | 46 return true; |
| 43 } | 47 } |
| 44 return false; | 48 return false; |
| 45 } | 49 } |
| 46 | 50 |
| 47 } // namespace ui | 51 } // namespace ui |
| OLD | NEW |