OLD | NEW |
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 "aura/event.h" | 5 #include "aura/event.h" |
6 | 6 |
7 #include "aura/window.h" | |
8 | |
9 namespace aura { | 7 namespace aura { |
10 | 8 |
11 Event::Event(ui::EventType type, int flags) | 9 Event::Event(ui::EventType type, int flags) |
12 : type_(type), | 10 : type_(type), |
13 time_stamp_(base::Time::NowFromSystemTime()), | 11 time_stamp_(base::Time::NowFromSystemTime()), |
14 flags_(flags) { | 12 flags_(flags) { |
15 Init(); | 13 Init(); |
16 } | 14 } |
17 | 15 |
18 Event::Event(NativeEvent native_event, ui::EventType type, int flags) | 16 Event::Event(NativeEvent native_event, ui::EventType type, int flags) |
19 : type_(type), | 17 : type_(type), |
20 time_stamp_(base::Time::NowFromSystemTime()), | 18 time_stamp_(base::Time::NowFromSystemTime()), |
21 flags_(flags) { | 19 flags_(flags) { |
22 InitWithNativeEvent(native_event); | 20 InitWithNativeEvent(native_event); |
23 } | 21 } |
24 | 22 |
25 Event::Event(const Event& copy) | 23 Event::Event(const Event& copy) |
26 : native_event_(copy.native_event_), | 24 : native_event_(copy.native_event_), |
27 type_(copy.type_), | 25 type_(copy.type_), |
28 time_stamp_(copy.time_stamp_), | 26 time_stamp_(copy.time_stamp_), |
29 flags_(copy.flags_) { | 27 flags_(copy.flags_) { |
30 } | 28 } |
31 | 29 |
32 LocatedEvent::LocatedEvent(const LocatedEvent& model, | |
33 Window* source, | |
34 Window* target) | |
35 : Event(model), | |
36 location_(model.location_) { | |
37 if (target && target != source) | |
38 Window::ConvertPointToWindow(source, target, &location_); | |
39 } | |
40 | |
41 MouseEvent::MouseEvent(const MouseEvent& model, Window* source, Window* target) | |
42 : LocatedEvent(model, source, target) { | |
43 } | |
44 | |
45 } // namespace aura | 30 } // namespace aura |
46 | 31 |
OLD | NEW |