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/views/events/event.h" | 5 #include "ui/views/events/event.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/aura/event.h" | 8 #include "ui/base/event.h" |
9 #include "ui/base/keycodes/keyboard_code_conversion.h" | 9 #include "ui/base/keycodes/keyboard_code_conversion.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
12 | 12 |
13 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
14 // LocatedEvent, protected: | 14 // LocatedEvent, protected: |
15 | 15 |
16 LocatedEvent::LocatedEvent(const NativeEvent& native_event) | 16 LocatedEvent::LocatedEvent(const NativeEvent& native_event) |
17 : Event(native_event, native_event->type(), native_event->flags()), | 17 : Event(native_event, native_event->type(), native_event->flags()), |
18 location_(static_cast<aura::LocatedEvent*>(native_event)->location()) { | 18 location_(static_cast<ui::LocatedEvent*>(native_event)->location()) { |
19 } | 19 } |
20 | 20 |
21 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
22 // TouchEvent, public: | 22 // TouchEvent, public: |
23 | 23 |
24 TouchEvent::TouchEvent(const NativeEvent& event) | 24 TouchEvent::TouchEvent(const NativeEvent& event) |
25 : LocatedEvent(event), | 25 : LocatedEvent(event), |
26 touch_id_(static_cast<aura::TouchEvent*>(event)->touch_id()), | 26 touch_id_(static_cast<ui::TouchEventImpl*>(event)->touch_id()), |
27 radius_x_(static_cast<aura::TouchEvent*>(event)->radius_x()), | 27 radius_x_(static_cast<ui::TouchEventImpl*>(event)->radius_x()), |
28 radius_y_(static_cast<aura::TouchEvent*>(event)->radius_y()), | 28 radius_y_(static_cast<ui::TouchEventImpl*>(event)->radius_y()), |
29 rotation_angle_(static_cast<aura::TouchEvent*>(event)->rotation_angle()), | 29 rotation_angle_( |
30 force_(static_cast<aura::TouchEvent*>(event)->force()) { | 30 static_cast<ui::TouchEventImpl*>(event)->rotation_angle()), |
| 31 force_(static_cast<ui::TouchEventImpl*>(event)->force()) { |
31 } | 32 } |
32 | 33 |
33 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
34 // KeyEvent, public: | 35 // KeyEvent, public: |
35 | 36 |
36 KeyEvent::KeyEvent(const NativeEvent& native_event) | 37 KeyEvent::KeyEvent(const NativeEvent& native_event) |
37 : Event(native_event, native_event->type(), native_event->flags()), | 38 : Event(native_event, native_event->type(), native_event->flags()), |
38 key_code_(static_cast<aura::KeyEvent*>(native_event)->key_code()), | 39 key_code_(static_cast<ui::KeyEvent*>(native_event)->key_code()), |
39 character_(ui::GetCharacterFromKeyCode(key_code_, flags())), | 40 character_(ui::GetCharacterFromKeyCode(key_code_, flags())), |
40 unmodified_character_(0) { | 41 unmodified_character_(0) { |
41 } | 42 } |
42 | 43 |
43 uint16 KeyEvent::GetCharacter() const { | 44 uint16 KeyEvent::GetCharacter() const { |
44 return character_; | 45 return character_; |
45 } | 46 } |
46 | 47 |
47 uint16 KeyEvent::GetUnmodifiedCharacter() const { | 48 uint16 KeyEvent::GetUnmodifiedCharacter() const { |
48 if (unmodified_character_) | 49 if (unmodified_character_) |
(...skipping 17 matching lines...) Expand all Loading... |
66 : MouseEvent(native_event) { | 67 : MouseEvent(native_event) { |
67 CHECK(ui::GetScrollOffsets( | 68 CHECK(ui::GetScrollOffsets( |
68 native_event->native_event(), &x_offset_, &y_offset_)); | 69 native_event->native_event(), &x_offset_, &y_offset_)); |
69 } | 70 } |
70 | 71 |
71 //////////////////////////////////////////////////////////////////////////////// | 72 //////////////////////////////////////////////////////////////////////////////// |
72 // GestureEvent, public: | 73 // GestureEvent, public: |
73 | 74 |
74 GestureEvent::GestureEvent(const NativeEvent& event) | 75 GestureEvent::GestureEvent(const NativeEvent& event) |
75 : LocatedEvent(event), | 76 : LocatedEvent(event), |
76 details_(static_cast<aura::GestureEvent*>(event)->details()) { | 77 details_(static_cast<ui::GestureEventImpl*>(event)->details()) { |
77 } | 78 } |
78 | 79 |
79 int GestureEvent::GetLowestTouchId() const { | 80 int GestureEvent::GetLowestTouchId() const { |
80 return native_event() ? static_cast<aura::GestureEvent*>( | 81 return native_event() ? static_cast<ui::GestureEventImpl*>( |
81 native_event())->GetLowestTouchId() : 0; | 82 native_event())->GetLowestTouchId() : 0; |
82 } | 83 } |
83 | 84 |
84 } // namespace views | 85 } // namespace views |
OLD | NEW |