| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef PlatformEvent_h | 26 #ifndef PlatformEvent_h |
| 27 #define PlatformEvent_h | 27 #define PlatformEvent_h |
| 28 | 28 |
| 29 #include "wtf/Allocator.h" | 29 #include "wtf/Allocator.h" |
| 30 #include "wtf/Noncopyable.h" | 30 #include "wtf/Noncopyable.h" |
| 31 #include "wtf/Time.h" |
| 31 | 32 |
| 32 namespace blink { | 33 namespace blink { |
| 33 | 34 |
| 34 class PlatformEvent { | 35 class PlatformEvent { |
| 35 public: | 36 public: |
| 36 enum EventType { | 37 enum EventType { |
| 37 NoType = 0, | 38 NoType = 0, |
| 38 | 39 |
| 39 // PlatformMouseEvent | 40 // PlatformMouseEvent |
| 40 MouseMoved, | 41 MouseMoved, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 132 |
| 132 EventType type() const { return static_cast<EventType>(m_type); } | 133 EventType type() const { return static_cast<EventType>(m_type); } |
| 133 | 134 |
| 134 bool shiftKey() const { return m_modifiers & ShiftKey; } | 135 bool shiftKey() const { return m_modifiers & ShiftKey; } |
| 135 bool ctrlKey() const { return m_modifiers & CtrlKey; } | 136 bool ctrlKey() const { return m_modifiers & CtrlKey; } |
| 136 bool altKey() const { return m_modifiers & AltKey; } | 137 bool altKey() const { return m_modifiers & AltKey; } |
| 137 bool metaKey() const { return m_modifiers & MetaKey; } | 138 bool metaKey() const { return m_modifiers & MetaKey; } |
| 138 | 139 |
| 139 Modifiers getModifiers() const { return static_cast<Modifiers>(m_modifiers); } | 140 Modifiers getModifiers() const { return static_cast<Modifiers>(m_modifiers); } |
| 140 | 141 |
| 141 double timestamp() const { return m_timestamp; } | 142 TimeTicks timestamp() const { return m_timestamp; } |
| 142 | 143 |
| 143 protected: | 144 protected: |
| 144 PlatformEvent() : m_type(NoType), m_modifiers(), m_timestamp(0) {} | 145 PlatformEvent() : m_type(NoType), m_modifiers() {} |
| 145 | 146 |
| 146 explicit PlatformEvent(EventType type) | 147 explicit PlatformEvent(EventType type) : m_type(type), m_modifiers(0) {} |
| 147 : m_type(type), m_modifiers(0), m_timestamp(0) {} | |
| 148 | 148 |
| 149 PlatformEvent(EventType type, Modifiers modifiers, double timestamp) | 149 PlatformEvent(EventType type, Modifiers modifiers, TimeTicks timestamp) |
| 150 : m_type(type), m_modifiers(modifiers), m_timestamp(timestamp) {} | 150 : m_type(type), m_modifiers(modifiers), m_timestamp(timestamp) {} |
| 151 | 151 |
| 152 // Explicit protected destructor so that people don't accidentally | 152 // Explicit protected destructor so that people don't accidentally |
| 153 // delete a PlatformEvent. | 153 // delete a PlatformEvent. |
| 154 ~PlatformEvent() {} | 154 ~PlatformEvent() {} |
| 155 | 155 |
| 156 unsigned m_type; | 156 unsigned m_type; |
| 157 unsigned m_modifiers; | 157 unsigned m_modifiers; |
| 158 double m_timestamp; | 158 TimeTicks m_timestamp; |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 } // namespace blink | 161 } // namespace blink |
| 162 | 162 |
| 163 #endif // PlatformEvent_h | 163 #endif // PlatformEvent_h |
| OLD | NEW |