Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: components/exo/keyboard.h

Issue 2506263002: exo: Implement support for zcr_keyboard_configuration_v1 protocol. (Closed)
Patch Set: add one more TODO Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/exo/BUILD.gn ('k') | components/exo/keyboard.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_EXO_KEYBOARD_H_ 5 #ifndef COMPONENTS_EXO_KEYBOARD_H_
6 #define COMPONENTS_EXO_KEYBOARD_H_ 6 #define COMPONENTS_EXO_KEYBOARD_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/exo/surface_observer.h" 11 #include "components/exo/surface_observer.h"
12 #include "components/exo/wm_helper.h" 12 #include "components/exo/wm_helper.h"
13 #include "ui/aura/client/focus_change_observer.h"
14 #include "ui/events/event_handler.h" 13 #include "ui/events/event_handler.h"
15 14
16 namespace ui { 15 namespace ui {
17 enum class DomCode; 16 enum class DomCode;
18 class KeyEvent; 17 class KeyEvent;
19 } 18 }
20 19
21 namespace exo { 20 namespace exo {
22 class KeyboardDelegate; 21 class KeyboardDelegate;
22 class KeyboardDeviceConfigurationDelegate;
23 class Surface; 23 class Surface;
24 24
25 // This class implements a client keyboard that represents one or more keyboard 25 // This class implements a client keyboard that represents one or more keyboard
26 // devices. 26 // devices.
27 class Keyboard : public ui::EventHandler, 27 class Keyboard : public ui::EventHandler,
28 public WMHelper::FocusObserver, 28 public WMHelper::FocusObserver,
29 public WMHelper::InputDeviceEventObserver,
30 public WMHelper::MaximizeModeObserver,
29 public SurfaceObserver { 31 public SurfaceObserver {
30 public: 32 public:
31 explicit Keyboard(KeyboardDelegate* delegate); 33 explicit Keyboard(KeyboardDelegate* delegate);
32 ~Keyboard() override; 34 ~Keyboard() override;
33 35
36 void SetDeviceConfigurationDelegate(
37 KeyboardDeviceConfigurationDelegate* delegate);
38
34 // Overridden from ui::EventHandler: 39 // Overridden from ui::EventHandler:
35 void OnKeyEvent(ui::KeyEvent* event) override; 40 void OnKeyEvent(ui::KeyEvent* event) override;
36 41
37 // Overridden WMHelper::FocusObserver: 42 // Overridden WMHelper::FocusObserver:
38 void OnWindowFocused(aura::Window* gained_focus, 43 void OnWindowFocused(aura::Window* gained_focus,
39 aura::Window* lost_focus) override; 44 aura::Window* lost_focus) override;
40 45
41 // Overridden from SurfaceObserver: 46 // Overridden from SurfaceObserver:
42 void OnSurfaceDestroying(Surface* surface) override; 47 void OnSurfaceDestroying(Surface* surface) override;
43 48
49 // Overridden from ui::InputDeviceEventObserver:
50 void OnKeyboardDeviceConfigurationChanged() override;
51
52 // Overridden from WMHelper::MaximizeModeObserver:
53 void OnMaximizeModeStarted() override;
54 void OnMaximizeModeEnded() override;
55
44 private: 56 private:
45 // Returns the effective focus for |window|. 57 // Returns the effective focus for |window|.
46 Surface* GetEffectiveFocus(aura::Window* window) const; 58 Surface* GetEffectiveFocus(aura::Window* window) const;
47 59
48 // The delegate instance that all events are dispatched to. 60 // The delegate instance that all events except for events about device
61 // configuration are dispatched to.
49 KeyboardDelegate* const delegate_; 62 KeyboardDelegate* const delegate_;
50 63
64 // The delegate instance that events about device configuration are dispatched
65 // to.
66 KeyboardDeviceConfigurationDelegate* device_configuration_delegate_ = nullptr;
67
51 // The current focus surface for the keyboard. 68 // The current focus surface for the keyboard.
52 Surface* focus_ = nullptr; 69 Surface* focus_ = nullptr;
53 70
54 // Vector of currently pressed keys. 71 // Vector of currently pressed keys.
55 std::vector<ui::DomCode> pressed_keys_; 72 std::vector<ui::DomCode> pressed_keys_;
56 73
57 // Current set of modifier flags. 74 // Current set of modifier flags.
58 int modifier_flags_ = 0; 75 int modifier_flags_ = 0;
59 76
60 DISALLOW_COPY_AND_ASSIGN(Keyboard); 77 DISALLOW_COPY_AND_ASSIGN(Keyboard);
61 }; 78 };
62 79
63 } // namespace exo 80 } // namespace exo
64 81
65 #endif // COMPONENTS_EXO_KEYBOARD_H_ 82 #endif // COMPONENTS_EXO_KEYBOARD_H_
OLDNEW
« no previous file with comments | « components/exo/BUILD.gn ('k') | components/exo/keyboard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698