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
3 // found in the LICENSE file.
5 #include "ui/events/event_utils.h"
9 #include "ui/events/event.h"
10 #include "ui/gfx/display.h"
11 #include "ui/gfx/screen.h"
16 int g_custom_event_types = ET_LAST;
19 int RegisterCustomEventType() {
20 return ++g_custom_event_types;
23 base::TimeDelta EventTimeForNow() {
24 return base::TimeDelta::FromInternalValue(
25 base::TimeTicks::Now().ToInternalValue());
28 bool ShouldDefaultToNaturalScroll() {
29 return GetInternalDisplayTouchSupport() ==
30 gfx::Display::TOUCH_SUPPORT_AVAILABLE;
33 gfx::Display::TouchSupport GetInternalDisplayTouchSupport() {
34 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE);
35 // No screen in some unit tests.
37 return gfx::Display::TOUCH_SUPPORT_UNKNOWN;
38 const std::vector<gfx::Display>& displays = screen->GetAllDisplays();
39 for (std::vector<gfx::Display>::const_iterator it = displays.begin();
40 it != displays.end(); ++it) {
42 return it->touch_support();
44 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE;