| 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 KeyboardEventManager_h | 5 #ifndef KeyboardEventManager_h |
| 6 #define KeyboardEventManager_h | 6 #define KeyboardEventManager_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/PlatformEvent.h" | 9 #include "platform/PlatformEvent.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 #include "platform/heap/Visitor.h" | 11 #include "platform/heap/Visitor.h" |
| 12 #include "public/platform/WebFocusType.h" | 12 #include "public/platform/WebFocusType.h" |
| 13 #include "public/platform/WebInputEvent.h" | 13 #include "public/platform/WebInputEvent.h" |
| 14 #include "public/platform/WebInputEventResult.h" | 14 #include "public/platform/WebInputEventResult.h" |
| 15 #include "wtf/Allocator.h" | 15 #include "wtf/Allocator.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class KeyboardEvent; | 19 class KeyboardEvent; |
| 20 class LocalFrame; | 20 class LocalFrame; |
| 21 class ScrollManager; | 21 class ScrollManager; |
| 22 | 22 |
| 23 enum class OverrideCapsLockState { | 23 enum class OverrideCapsLockState { |
| 24 Default, | 24 Default, |
| 25 On, | 25 On, |
| 26 Off | 26 Off |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 class CORE_EXPORT KeyboardEventManager { | 29 class CORE_EXPORT KeyboardEventManager : public GarbageCollectedFinalized<Keyboa
rdEventManager> { |
| 30 WTF_MAKE_NONCOPYABLE(KeyboardEventManager); | 30 WTF_MAKE_NONCOPYABLE(KeyboardEventManager); |
| 31 DISALLOW_NEW(); | |
| 32 public: | 31 public: |
| 33 static const int kAccessKeyModifiers = | 32 static const int kAccessKeyModifiers = |
| 34 // TODO(crbug.com/618397): Add a settings to control this behavior. | 33 // TODO(crbug.com/618397): Add a settings to control this behavior. |
| 35 #if OS(MACOSX) | 34 #if OS(MACOSX) |
| 36 WebInputEvent::ControlKey | WebInputEvent::AltKey; | 35 WebInputEvent::ControlKey | WebInputEvent::AltKey; |
| 37 #else | 36 #else |
| 38 WebInputEvent::AltKey; | 37 WebInputEvent::AltKey; |
| 39 #endif | 38 #endif |
| 40 | 39 |
| 41 KeyboardEventManager(LocalFrame*, ScrollManager*); | 40 KeyboardEventManager(LocalFrame*, ScrollManager*); |
| 42 ~KeyboardEventManager(); | |
| 43 DECLARE_TRACE(); | 41 DECLARE_TRACE(); |
| 44 | 42 |
| 45 bool handleAccessKey(const WebKeyboardEvent&); | 43 bool handleAccessKey(const WebKeyboardEvent&); |
| 46 WebInputEventResult keyEvent(const WebKeyboardEvent&); | 44 WebInputEventResult keyEvent(const WebKeyboardEvent&); |
| 47 void defaultKeyboardEventHandler(KeyboardEvent*, Node*); | 45 void defaultKeyboardEventHandler(KeyboardEvent*, Node*); |
| 48 | 46 |
| 49 void capsLockStateMayHaveChanged(); | 47 void capsLockStateMayHaveChanged(); |
| 50 static WebInputEvent::Modifiers getCurrentModifierState(); | 48 static WebInputEvent::Modifiers getCurrentModifierState(); |
| 51 static bool currentCapsLockState(); | 49 static bool currentCapsLockState(); |
| 52 | 50 |
| 53 private: | 51 private: |
| 54 friend class Internals; | 52 friend class Internals; |
| 55 // Allows overriding the current caps lock state for testing purposes. | 53 // Allows overriding the current caps lock state for testing purposes. |
| 56 static void setCurrentCapsLockState(OverrideCapsLockState); | 54 static void setCurrentCapsLockState(OverrideCapsLockState); |
| 57 | 55 |
| 58 void defaultSpaceEventHandler(KeyboardEvent*, Node*); | 56 void defaultSpaceEventHandler(KeyboardEvent*, Node*); |
| 59 void defaultBackspaceEventHandler(KeyboardEvent*); | 57 void defaultBackspaceEventHandler(KeyboardEvent*); |
| 60 void defaultTabEventHandler(KeyboardEvent*); | 58 void defaultTabEventHandler(KeyboardEvent*); |
| 61 void defaultEscapeEventHandler(KeyboardEvent*); | 59 void defaultEscapeEventHandler(KeyboardEvent*); |
| 62 void defaultArrowEventHandler(WebFocusType, KeyboardEvent*); | 60 void defaultArrowEventHandler(WebFocusType, KeyboardEvent*); |
| 63 | 61 |
| 64 const Member<LocalFrame> m_frame; | 62 const Member<LocalFrame> m_frame; |
| 65 | 63 |
| 66 ScrollManager* m_scrollManager; | 64 Member<ScrollManager> m_scrollManager; |
| 67 }; | 65 }; |
| 68 | 66 |
| 69 } // namespace blink | 67 } // namespace blink |
| 70 | 68 |
| 71 #endif // KeyboardEventManager_h | 69 #endif // KeyboardEventManager_h |
| OLD | NEW |