| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 InputEvent_h | 5 #ifndef InputEvent_h |
| 6 #define InputEvent_h | 6 #define InputEvent_h |
| 7 | 7 |
| 8 #include "core/events/InputEventInit.h" | 8 #include "core/events/InputEventInit.h" |
| 9 #include "core/events/UIEvent.h" | 9 #include "core/events/UIEvent.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class InputEvent final : public UIEvent { | 13 class InputEvent final : public UIEvent { |
| 14 DEFINE_WRAPPERTYPEINFO(); | 14 DEFINE_WRAPPERTYPEINFO(); |
| 15 | 15 |
| 16 public: | 16 public: |
| 17 static PassRefPtrWillBeRawPtr<InputEvent> create() | 17 static PassRefPtrWillBeRawPtr<InputEvent> create() |
| 18 { | 18 { |
| 19 return adoptRefWillBeNoop(new InputEvent); | 19 return adoptRefWillBeNoop(new InputEvent); |
| 20 } | 20 } |
| 21 | 21 |
| 22 static PassRefPtrWillBeRawPtr<InputEvent> create(const AtomicString& type, c
onst InputEventInit& initializer) | 22 static PassRefPtrWillBeRawPtr<InputEvent> create(const AtomicString& type, c
onst InputEventInit& initializer) |
| 23 { | 23 { |
| 24 return adoptRefWillBeNoop(new InputEvent(type, initializer)); | 24 return adoptRefWillBeNoop(new InputEvent(type, initializer)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 enum class InputType { |
| 28 InsertText, |
| 29 ReplaceText, |
| 30 }; |
| 31 |
| 32 static PassRefPtrWillBeRawPtr<InputEvent> createBeforeInputTyping(InputType,
const String& data); |
| 33 static PassRefPtrWillBeRawPtr<InputEvent> createBeforeInputCompositionUpdate
(InputType, const String& data); |
| 34 static PassRefPtrWillBeRawPtr<InputEvent> createBeforeInputEditorCommand(con
st String& commandName, const String& data); |
| 35 |
| 36 const String& inputType() const { return m_inputType; } |
| 37 const String& data() const { return m_data; } |
| 38 |
| 27 bool isInputEvent() const override; | 39 bool isInputEvent() const override; |
| 28 | 40 |
| 29 DECLARE_VIRTUAL_TRACE(); | 41 DECLARE_VIRTUAL_TRACE(); |
| 30 | 42 |
| 31 private: | 43 private: |
| 32 InputEvent(); | 44 InputEvent(); |
| 33 InputEvent(const AtomicString&, const InputEventInit&); | 45 InputEvent(const AtomicString&, const InputEventInit&); |
| 46 |
| 47 String m_inputType; |
| 48 String m_data; |
| 34 }; | 49 }; |
| 35 | 50 |
| 36 DEFINE_EVENT_TYPE_CASTS(InputEvent); | 51 DEFINE_EVENT_TYPE_CASTS(InputEvent); |
| 37 | 52 |
| 38 } // namespace blink | 53 } // namespace blink |
| 39 | 54 |
| 40 #endif // InputEvent_h | 55 #endif // InputEvent_h |
| OLD | NEW |