| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "aura/event.h" | |
| 6 | |
| 7 #include "aura/window.h" | |
| 8 | |
| 9 namespace aura { | |
| 10 | |
| 11 Event::Event(ui::EventType type, int flags) | |
| 12 : type_(type), | |
| 13 time_stamp_(base::Time::NowFromSystemTime()), | |
| 14 flags_(flags) { | |
| 15 Init(); | |
| 16 } | |
| 17 | |
| 18 Event::Event(NativeEvent native_event, ui::EventType type, int flags) | |
| 19 : type_(type), | |
| 20 time_stamp_(base::Time::NowFromSystemTime()), | |
| 21 flags_(flags) { | |
| 22 InitWithNativeEvent(native_event); | |
| 23 } | |
| 24 | |
| 25 Event::Event(const Event& copy) | |
| 26 : native_event_(copy.native_event_), | |
| 27 type_(copy.type_), | |
| 28 time_stamp_(copy.time_stamp_), | |
| 29 flags_(copy.flags_) { | |
| 30 } | |
| 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 LocatedEvent::LocatedEvent(ui::EventType type, | |
| 42 const gfx::Point& location, | |
| 43 int flags) | |
| 44 : Event(type, flags), | |
| 45 location_(location) { | |
| 46 } | |
| 47 | |
| 48 MouseEvent::MouseEvent(const MouseEvent& model, Window* source, Window* target) | |
| 49 : LocatedEvent(model, source, target) { | |
| 50 } | |
| 51 | |
| 52 MouseEvent::MouseEvent(ui::EventType type, | |
| 53 const gfx::Point& location, | |
| 54 int flags) | |
| 55 : LocatedEvent(type, location, flags) { | |
| 56 } | |
| 57 | |
| 58 KeyEvent::KeyEvent(ui::EventType type, | |
| 59 ui::KeyboardCode key_code, | |
| 60 int flags) | |
| 61 : Event(type, flags), | |
| 62 key_code_(key_code) { | |
| 63 } | |
| 64 | |
| 65 } // namespace aura | |
| 66 | |
| OLD | NEW |