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 #ifndef UI_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_EVENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 |
9 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
10 #include "base/event_types.h" | 13 #include "base/event_types.h" |
11 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
12 #include "base/logging.h" | 15 #include "base/logging.h" |
13 #include "base/macros.h" | 16 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/time/time.h" | 17 #include "base/time/time.h" |
16 #include "ui/events/event_constants.h" | 18 #include "ui/events/event_constants.h" |
17 #include "ui/events/gesture_event_details.h" | 19 #include "ui/events/gesture_event_details.h" |
18 #include "ui/events/gestures/gesture_types.h" | 20 #include "ui/events/gestures/gesture_types.h" |
19 #include "ui/events/keycodes/dom/dom_key.h" | 21 #include "ui/events/keycodes/dom/dom_key.h" |
20 #include "ui/events/keycodes/keyboard_codes.h" | 22 #include "ui/events/keycodes/keyboard_codes.h" |
21 #include "ui/events/latency_info.h" | 23 #include "ui/events/latency_info.h" |
22 #include "ui/gfx/geometry/point.h" | 24 #include "ui/gfx/geometry/point.h" |
23 #include "ui/gfx/geometry/point_conversions.h" | 25 #include "ui/gfx/geometry/point_conversions.h" |
24 | 26 |
(...skipping 10 matching lines...) Expand all Loading... |
35 class KeyEvent; | 37 class KeyEvent; |
36 class MouseEvent; | 38 class MouseEvent; |
37 class MouseWheelEvent; | 39 class MouseWheelEvent; |
38 class PointerEvent; | 40 class PointerEvent; |
39 class ScrollEvent; | 41 class ScrollEvent; |
40 class TouchEvent; | 42 class TouchEvent; |
41 enum class DomCode; | 43 enum class DomCode; |
42 class Event; | 44 class Event; |
43 class MouseWheelEvent; | 45 class MouseWheelEvent; |
44 | 46 |
45 using ScopedEvent = scoped_ptr<Event>; | 47 using ScopedEvent = std::unique_ptr<Event>; |
46 | 48 |
47 class EVENTS_EXPORT Event { | 49 class EVENTS_EXPORT Event { |
48 public: | 50 public: |
49 static scoped_ptr<Event> Clone(const Event& event); | 51 static std::unique_ptr<Event> Clone(const Event& event); |
50 | 52 |
51 virtual ~Event(); | 53 virtual ~Event(); |
52 | 54 |
53 class DispatcherApi { | 55 class DispatcherApi { |
54 public: | 56 public: |
55 explicit DispatcherApi(Event* event) : event_(event) {} | 57 explicit DispatcherApi(Event* event) : event_(event) {} |
56 | 58 |
57 void set_target(EventTarget* target) { | 59 void set_target(EventTarget* target) { |
58 event_->target_ = target; | 60 event_->target_ = target; |
59 } | 61 } |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 KeyEvent& operator=(const KeyEvent& rhs); | 854 KeyEvent& operator=(const KeyEvent& rhs); |
853 | 855 |
854 ~KeyEvent() override; | 856 ~KeyEvent() override; |
855 | 857 |
856 // TODO(erg): While we transition to mojo, we have to hack around a mismatch | 858 // TODO(erg): While we transition to mojo, we have to hack around a mismatch |
857 // in our event types. Our ui::Events don't really have all the data we need | 859 // in our event types. Our ui::Events don't really have all the data we need |
858 // to process key events, and we instead do per-platform conversions with | 860 // to process key events, and we instead do per-platform conversions with |
859 // native HWNDs or XEvents. And we can't reliably send those native data | 861 // native HWNDs or XEvents. And we can't reliably send those native data |
860 // types across mojo types in a cross-platform way. So instead, we set the | 862 // types across mojo types in a cross-platform way. So instead, we set the |
861 // resulting data when read across IPC boundaries. | 863 // resulting data when read across IPC boundaries. |
862 void SetExtendedKeyEventData(scoped_ptr<ExtendedKeyEventData> data); | 864 void SetExtendedKeyEventData(std::unique_ptr<ExtendedKeyEventData> data); |
863 const ExtendedKeyEventData* extended_key_event_data() const { | 865 const ExtendedKeyEventData* extended_key_event_data() const { |
864 return extended_key_event_data_.get(); | 866 return extended_key_event_data_.get(); |
865 } | 867 } |
866 | 868 |
867 // This bypasses the normal mapping from keystroke events to characters, | 869 // This bypasses the normal mapping from keystroke events to characters, |
868 // which allows an I18N virtual keyboard to fabricate a keyboard event that | 870 // which allows an I18N virtual keyboard to fabricate a keyboard event that |
869 // does not have a corresponding KeyboardCode (example: U+00E1 Latin small | 871 // does not have a corresponding KeyboardCode (example: U+00E1 Latin small |
870 // letter A with acute, U+0410 Cyrillic capital letter A). | 872 // letter A with acute, U+0410 Cyrillic capital letter A). |
871 void set_character(base::char16 character) { | 873 void set_character(base::char16 character) { |
872 key_ = DomKey::FromCharacter(character); | 874 key_ = DomKey::FromCharacter(character); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 // This value represents the meaning of a key, which is either a Unicode | 967 // This value represents the meaning of a key, which is either a Unicode |
966 // character, or a named DomKey:: value. | 968 // character, or a named DomKey:: value. |
967 // This is not necessarily initialized when the event is constructed; | 969 // This is not necessarily initialized when the event is constructed; |
968 // it may be set only if and when GetCharacter() or GetDomKey() is called. | 970 // it may be set only if and when GetCharacter() or GetDomKey() is called. |
969 mutable DomKey key_ = DomKey::NONE; | 971 mutable DomKey key_ = DomKey::NONE; |
970 | 972 |
971 // Parts of our event handling require raw native events (see both the | 973 // Parts of our event handling require raw native events (see both the |
972 // windows and linux implementations of web_input_event in content/). Because | 974 // windows and linux implementations of web_input_event in content/). Because |
973 // mojo instead serializes and deserializes events in potentially different | 975 // mojo instead serializes and deserializes events in potentially different |
974 // processes, we need to have a mechanism to keep track of this data. | 976 // processes, we need to have a mechanism to keep track of this data. |
975 scoped_ptr<ExtendedKeyEventData> extended_key_event_data_; | 977 std::unique_ptr<ExtendedKeyEventData> extended_key_event_data_; |
976 | 978 |
977 static bool IsRepeated(const KeyEvent& event); | 979 static bool IsRepeated(const KeyEvent& event); |
978 | 980 |
979 static KeyEvent* last_key_event_; | 981 static KeyEvent* last_key_event_; |
980 }; | 982 }; |
981 | 983 |
982 class EVENTS_EXPORT ScrollEvent : public MouseEvent { | 984 class EVENTS_EXPORT ScrollEvent : public MouseEvent { |
983 public: | 985 public: |
984 explicit ScrollEvent(const base::NativeEvent& native_event); | 986 explicit ScrollEvent(const base::NativeEvent& native_event); |
985 template <class T> | 987 template <class T> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 : LocatedEvent(type, time_stamp, flags) {} | 1062 : LocatedEvent(type, time_stamp, flags) {} |
1061 friend struct IPC::ParamTraits<ui::ScopedEvent>; | 1063 friend struct IPC::ParamTraits<ui::ScopedEvent>; |
1062 friend struct IPC::ParamTraits<ui::GestureEvent>; | 1064 friend struct IPC::ParamTraits<ui::GestureEvent>; |
1063 | 1065 |
1064 GestureEventDetails details_; | 1066 GestureEventDetails details_; |
1065 }; | 1067 }; |
1066 | 1068 |
1067 } // namespace ui | 1069 } // namespace ui |
1068 | 1070 |
1069 #endif // UI_EVENTS_EVENT_H_ | 1071 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |