Chromium Code Reviews| Index: ui/events/event.h |
| diff --git a/ui/events/event.h b/ui/events/event.h |
| index cfac55ca118f57abcff2dd76918676f0eece173a..c65d8d1507951d87d63908e9f968bfdda22bf7d7 100644 |
| --- a/ui/events/event.h |
| +++ b/ui/events/event.h |
| @@ -8,6 +8,9 @@ |
| #include <stdint.h> |
| #include <memory> |
| +#include <string> |
| +#include <unordered_map> |
| +#include <vector> |
| #include "base/compiler_specific.h" |
| #include "base/event_types.h" |
| @@ -798,6 +801,8 @@ class EVENTS_EXPORT PointerEvent : public LocatedEvent { |
| // |
| class EVENTS_EXPORT KeyEvent : public Event { |
| public: |
| + using Properties = std::unordered_map<std::string, std::vector<uint8_t>>; |
| + |
| // Create a KeyEvent from a NativeEvent. For Windows this native event can |
| // be either a keystroke message (WM_KEYUP/WM_KEYDOWN) or a character message |
| // (WM_CHAR). Other systems have only keystroke events. |
| @@ -904,6 +909,14 @@ class EVENTS_EXPORT KeyEvent : public Event { |
| // (Native X11 event flags describe the state before the event.) |
| void NormalizeFlags(); |
| + // Sets the properties associated with this KeyEvent. |
| + void SetProperties(const Properties& properties); |
| + |
| + // Returns the properties associated with this event, which may be null. |
| + // The properties are meant to provide a way to associate arbitrary key/value |
| + // pairs with KeyEvents and not used by KeyEvent. |
| + const Properties* properties() const { return properties_.get(); } |
| + |
| protected: |
| friend class KeyEventTestApi; |
| @@ -914,6 +927,8 @@ class EVENTS_EXPORT KeyEvent : public Event { |
| // Determine key_ on a keystroke event from code_ and flags(). |
| void ApplyLayout() const; |
| + static bool IsRepeated(const KeyEvent& event); |
| + |
| KeyboardCode key_code_; |
| // DOM KeyboardEvent |code| (e.g. DomCode::US_A, DomCode::SPACE). |
| @@ -940,7 +955,7 @@ class EVENTS_EXPORT KeyEvent : public Event { |
| // it may be set only if and when GetCharacter() or GetDomKey() is called. |
| mutable DomKey key_ = DomKey::NONE; |
| - static bool IsRepeated(const KeyEvent& event); |
| + std::unique_ptr<Properties> properties_; |
|
sadrul
2017/03/21 17:21:14
Should this be a base::Optional?
sky
2017/03/21 17:25:37
My understanding is that base::Optional's size is
|
| static KeyEvent* last_key_event_; |
| }; |