Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: ui/aura/event.cc

Issue 8113028: Consolidate ui::NativeEvent and base::NativeEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync/resolve Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/event.h ('k') | ui/base/events.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/aura/event.h" 5 #include "ui/aura/event.h"
6 6
7 #include "ui/aura/window.h" 7 #include "ui/aura/window.h"
8 8
9 namespace aura { 9 namespace aura {
10 10
11 Event::Event(ui::EventType type, int flags) 11 Event::Event(ui::EventType type, int flags)
12 : type_(type), 12 : type_(type),
13 time_stamp_(base::Time::NowFromSystemTime()), 13 time_stamp_(base::Time::NowFromSystemTime()),
14 flags_(flags) { 14 flags_(flags) {
15 Init(); 15 Init();
16 } 16 }
17 17
18 Event::Event(const ui::NativeEvent& native_event, ui::EventType type, int flags) 18 Event::Event(const base::NativeEvent& native_event,
19 ui::EventType type,
20 int flags)
19 : type_(type), 21 : type_(type),
20 time_stamp_(base::Time::NowFromSystemTime()), 22 time_stamp_(base::Time::NowFromSystemTime()),
21 flags_(flags) { 23 flags_(flags) {
22 InitWithNativeEvent(native_event); 24 InitWithNativeEvent(native_event);
23 } 25 }
24 26
25 Event::Event(const Event& copy) 27 Event::Event(const Event& copy)
26 : native_event_(copy.native_event_), 28 : native_event_(copy.native_event_),
27 type_(copy.type_), 29 type_(copy.type_),
28 time_stamp_(copy.time_stamp_), 30 time_stamp_(copy.time_stamp_),
29 flags_(copy.flags_) { 31 flags_(copy.flags_) {
30 } 32 }
31 33
32 void Event::Init() { 34 void Event::Init() {
33 memset(&native_event_, 0, sizeof(native_event_)); 35 memset(&native_event_, 0, sizeof(native_event_));
34 } 36 }
35 37
36 void Event::InitWithNativeEvent(const ui::NativeEvent& native_event) { 38 void Event::InitWithNativeEvent(const base::NativeEvent& native_event) {
37 native_event_ = native_event; 39 native_event_ = native_event;
38 } 40 }
39 41
40 LocatedEvent::LocatedEvent(const ui::NativeEvent& native_event) 42 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event)
41 : Event(native_event, 43 : Event(native_event,
42 ui::EventTypeFromNative(native_event), 44 ui::EventTypeFromNative(native_event),
43 ui::EventFlagsFromNative(native_event)), 45 ui::EventFlagsFromNative(native_event)),
44 location_(ui::EventLocationFromNative(native_event)) { 46 location_(ui::EventLocationFromNative(native_event)) {
45 } 47 }
46 48
47 LocatedEvent::LocatedEvent(const LocatedEvent& model, 49 LocatedEvent::LocatedEvent(const LocatedEvent& model,
48 Window* source, 50 Window* source,
49 Window* target) 51 Window* target)
50 : Event(model), 52 : Event(model),
51 location_(model.location_) { 53 location_(model.location_) {
52 if (target && target != source) 54 if (target && target != source)
53 Window::ConvertPointToWindow(source, target, &location_); 55 Window::ConvertPointToWindow(source, target, &location_);
54 } 56 }
55 57
56 LocatedEvent::LocatedEvent(ui::EventType type, 58 LocatedEvent::LocatedEvent(ui::EventType type,
57 const gfx::Point& location, 59 const gfx::Point& location,
58 int flags) 60 int flags)
59 : Event(type, flags), 61 : Event(type, flags),
60 location_(location) { 62 location_(location) {
61 } 63 }
62 64
63 MouseEvent::MouseEvent(const ui::NativeEvent& native_event) 65 MouseEvent::MouseEvent(const base::NativeEvent& native_event)
64 : LocatedEvent(native_event) { 66 : LocatedEvent(native_event) {
65 } 67 }
66 68
67 MouseEvent::MouseEvent(const MouseEvent& model, Window* source, Window* target) 69 MouseEvent::MouseEvent(const MouseEvent& model, Window* source, Window* target)
68 : LocatedEvent(model, source, target) { 70 : LocatedEvent(model, source, target) {
69 } 71 }
70 72
71 MouseEvent::MouseEvent(const MouseEvent& model, 73 MouseEvent::MouseEvent(const MouseEvent& model,
72 Window* source, 74 Window* source,
73 Window* target, 75 Window* target,
74 ui::EventType type) 76 ui::EventType type)
75 : LocatedEvent(model, source, target) { 77 : LocatedEvent(model, source, target) {
76 set_type(type); 78 set_type(type);
77 } 79 }
78 80
79 MouseEvent::MouseEvent(ui::EventType type, 81 MouseEvent::MouseEvent(ui::EventType type,
80 const gfx::Point& location, 82 const gfx::Point& location,
81 int flags) 83 int flags)
82 : LocatedEvent(type, location, flags) { 84 : LocatedEvent(type, location, flags) {
83 } 85 }
84 86
85 KeyEvent::KeyEvent(const ui::NativeEvent& native_event) 87 KeyEvent::KeyEvent(const base::NativeEvent& native_event)
86 : Event(native_event, 88 : Event(native_event,
87 ui::EventTypeFromNative(native_event), 89 ui::EventTypeFromNative(native_event),
88 ui::EventFlagsFromNative(native_event)), 90 ui::EventFlagsFromNative(native_event)),
89 key_code_(ui::KeyboardCodeFromNative(native_event)) { 91 key_code_(ui::KeyboardCodeFromNative(native_event)) {
90 } 92 }
91 93
92 KeyEvent::KeyEvent(ui::EventType type, 94 KeyEvent::KeyEvent(ui::EventType type,
93 ui::KeyboardCode key_code, 95 ui::KeyboardCode key_code,
94 int flags) 96 int flags)
95 : Event(type, flags), 97 : Event(type, flags),
96 key_code_(key_code) { 98 key_code_(key_code) {
97 } 99 }
98 100
99 } // namespace aura 101 } // namespace aura
100
OLDNEW
« no previous file with comments | « ui/aura/event.h ('k') | ui/base/events.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698