| 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/events/event.h" | 5 #include "ui/events/event.h" |
| 6 | 6 |
| 7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/keysym.h> | 9 #include <X11/keysym.h> |
| 10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } // namespace | 118 } // namespace |
| 119 | 119 |
| 120 namespace ui { | 120 namespace ui { |
| 121 | 121 |
| 122 //////////////////////////////////////////////////////////////////////////////// | 122 //////////////////////////////////////////////////////////////////////////////// |
| 123 // Event | 123 // Event |
| 124 | 124 |
| 125 // static | 125 // static |
| 126 scoped_ptr<Event> Event::Clone(const Event& event) { | 126 scoped_ptr<Event> Event::Clone(const Event& event) { |
| 127 if (event.IsKeyEvent()) { | 127 if (event.IsKeyEvent()) { |
| 128 return scoped_ptr<Event>(new KeyEvent(static_cast<const KeyEvent&>(event))); | 128 return make_scoped_ptr(new KeyEvent(static_cast<const KeyEvent&>(event))); |
| 129 } | 129 } |
| 130 | 130 |
| 131 if (event.IsMouseEvent()) { | 131 if (event.IsMouseEvent()) { |
| 132 if (event.IsMouseWheelEvent()) { | 132 if (event.IsMouseWheelEvent()) { |
| 133 return scoped_ptr<Event>( | 133 return make_scoped_ptr( |
| 134 new MouseWheelEvent(static_cast<const MouseWheelEvent&>(event))); | 134 new MouseWheelEvent(static_cast<const MouseWheelEvent&>(event))); |
| 135 } | 135 } |
| 136 | 136 |
| 137 return scoped_ptr<Event>( | 137 return make_scoped_ptr( |
| 138 new MouseEvent(static_cast<const MouseEvent&>(event))); | 138 new MouseEvent(static_cast<const MouseEvent&>(event))); |
| 139 } | 139 } |
| 140 | 140 |
| 141 if (event.IsTouchEvent()) { | 141 if (event.IsTouchEvent()) { |
| 142 return scoped_ptr<Event>( | 142 return make_scoped_ptr( |
| 143 new TouchEvent(static_cast<const TouchEvent&>(event))); | 143 new TouchEvent(static_cast<const TouchEvent&>(event))); |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (event.IsGestureEvent()) { | 146 if (event.IsGestureEvent()) { |
| 147 return scoped_ptr<Event>( | 147 return make_scoped_ptr( |
| 148 new GestureEvent(static_cast<const GestureEvent&>(event))); | 148 new GestureEvent(static_cast<const GestureEvent&>(event))); |
| 149 } | 149 } |
| 150 | 150 |
| 151 if (event.IsScrollEvent()) { | 151 if (event.IsScrollEvent()) { |
| 152 return scoped_ptr<Event>( | 152 return make_scoped_ptr( |
| 153 new ScrollEvent(static_cast<const ScrollEvent&>(event))); | 153 new ScrollEvent(static_cast<const ScrollEvent&>(event))); |
| 154 } | 154 } |
| 155 | 155 |
| 156 return scoped_ptr<Event>(new Event(event)); | 156 return make_scoped_ptr(new Event(event)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 Event::~Event() { | 159 Event::~Event() { |
| 160 if (delete_native_event_) | 160 if (delete_native_event_) |
| 161 ReleaseCopiedNativeEvent(native_event_); | 161 ReleaseCopiedNativeEvent(native_event_); |
| 162 } | 162 } |
| 163 | 163 |
| 164 GestureEvent* Event::AsGestureEvent() { | 164 GestureEvent* Event::AsGestureEvent() { |
| 165 CHECK(IsGestureEvent()); | 165 CHECK(IsGestureEvent()); |
| 166 return static_cast<GestureEvent*>(this); | 166 return static_cast<GestureEvent*>(this); |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 gfx::PointF(x, y), | 981 gfx::PointF(x, y), |
| 982 time_stamp, | 982 time_stamp, |
| 983 flags | EF_FROM_TOUCH), | 983 flags | EF_FROM_TOUCH), |
| 984 details_(details) { | 984 details_(details) { |
| 985 } | 985 } |
| 986 | 986 |
| 987 GestureEvent::~GestureEvent() { | 987 GestureEvent::~GestureEvent() { |
| 988 } | 988 } |
| 989 | 989 |
| 990 } // namespace ui | 990 } // namespace ui |
| OLD | NEW |