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" |
11 #include "ui/gfx/screen.h" | 11 #include "ui/gfx/screen.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
15 namespace { | 15 namespace { |
16 int g_custom_event_types = ET_LAST; | 16 int g_custom_event_types = ET_LAST; |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 scoped_ptr<Event> EventFromNative(const base::NativeEvent& native_event) { | 19 scoped_ptr<Event> EventFromNative(const base::NativeEvent& native_event) { |
20 scoped_ptr<Event> event; | 20 scoped_ptr<Event> event; |
21 EventType type = EventTypeFromNative(native_event); | 21 EventType type = EventTypeFromNative(native_event); |
22 switch(type) { | 22 switch(type) { |
23 case ET_KEY_PRESSED: | 23 case ET_KEY_PRESSED: |
24 case ET_KEY_RELEASED: | 24 case ET_KEY_RELEASED: |
25 event.reset(new KeyEvent(native_event, false)); | 25 event.reset(new KeyEvent(native_event)); |
26 break; | 26 break; |
27 | 27 |
28 case ET_TRANSLATED_KEY_PRESS: | 28 case ET_TRANSLATED_KEY_PRESS: |
29 case ET_TRANSLATED_KEY_RELEASE: | 29 case ET_TRANSLATED_KEY_RELEASE: |
30 // These should not be generated by native events. | 30 // These should not be generated by native events. |
31 NOTREACHED(); | 31 NOTREACHED(); |
32 break; | 32 break; |
33 | 33 |
34 case ET_MOUSE_PRESSED: | 34 case ET_MOUSE_PRESSED: |
35 case ET_MOUSE_DRAGGED: | 35 case ET_MOUSE_DRAGGED: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); | 85 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); |
86 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); | 86 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); |
87 it != displays.end(); ++it) { | 87 it != displays.end(); ++it) { |
88 if (it->IsInternal()) | 88 if (it->IsInternal()) |
89 return it->touch_support(); | 89 return it->touch_support(); |
90 } | 90 } |
91 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE; | 91 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE; |
92 } | 92 } |
93 | 93 |
94 } // namespace ui | 94 } // namespace ui |
OLD | NEW |