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 |
7 namespace aura { | 9 namespace aura { |
8 | 10 |
9 Event::Event(ui::EventType type, int flags) | 11 Event::Event(ui::EventType type, int flags) |
10 : type_(type), | 12 : type_(type), |
11 time_stamp_(base::Time::NowFromSystemTime()), | 13 time_stamp_(base::Time::NowFromSystemTime()), |
12 flags_(flags) { | 14 flags_(flags) { |
13 Init(); | 15 Init(); |
14 } | 16 } |
15 | 17 |
16 Event::Event(NativeEvent native_event, ui::EventType type, int flags) | 18 Event::Event(NativeEvent native_event, ui::EventType type, int flags) |
17 : type_(type), | 19 : type_(type), |
18 time_stamp_(base::Time::NowFromSystemTime()), | 20 time_stamp_(base::Time::NowFromSystemTime()), |
19 flags_(flags) { | 21 flags_(flags) { |
20 InitWithNativeEvent(native_event); | 22 InitWithNativeEvent(native_event); |
21 } | 23 } |
22 | 24 |
23 Event::Event(const Event& copy) | 25 Event::Event(const Event& copy) |
24 : native_event_(copy.native_event_), | 26 : native_event_(copy.native_event_), |
25 type_(copy.type_), | 27 type_(copy.type_), |
26 time_stamp_(copy.time_stamp_), | 28 time_stamp_(copy.time_stamp_), |
27 flags_(copy.flags_) { | 29 flags_(copy.flags_) { |
28 } | 30 } |
29 | 31 |
| 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 |
30 } // namespace aura | 45 } // namespace aura |
31 | 46 |
OLD | NEW |