Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BASE_IME_CHROMEOS_IME_KEYBOARD_H_ | 5 #ifndef UI_BASE_IME_CHROMEOS_IME_KEYBOARD_H_ |
| 6 #define UI_BASE_IME_CHROMEOS_IME_KEYBOARD_H_ | 6 #define UI_BASE_IME_CHROMEOS_IME_KEYBOARD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 // in user preferences. | 32 // in user preferences. |
| 33 kNumModifierKeys, | 33 kNumModifierKeys, |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class UI_BASE_IME_EXPORT ImeKeyboard { | 36 class UI_BASE_IME_EXPORT ImeKeyboard { |
| 37 public: | 37 public: |
| 38 class Observer { | 38 class Observer { |
| 39 public: | 39 public: |
| 40 // Called when the caps lock state has changed. | 40 // Called when the caps lock state has changed. |
| 41 virtual void OnCapsLockChanged(bool enabled) = 0; | 41 virtual void OnCapsLockChanged(bool enabled) = 0; |
| 42 | |
| 43 // Called when the layout state has changed. | |
| 44 virtual void OnLayoutChanged(const std::string& layout_name) = 0; | |
|
reveman
2017/06/09 21:15:18
OnLayoutChanging as GetCurrentKeyboardLayoutName()
jclinton
2017/06/09 22:17:59
Done.
| |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 ImeKeyboard(); | 47 ImeKeyboard(); |
| 45 virtual ~ImeKeyboard(); | 48 virtual ~ImeKeyboard(); |
| 46 // Adds/removes observer. | 49 // Adds/removes observer. |
| 47 virtual void AddObserver(Observer* observer); | 50 virtual void AddObserver(Observer* observer); |
| 48 virtual void RemoveObserver(Observer* observer); | 51 virtual void RemoveObserver(Observer* observer); |
| 49 | 52 |
| 50 // Sets the current keyboard layout to |layout_name|. This function does not | 53 // Sets the current keyboard layout to |layout_name|. This function does not |
| 51 // change the current mapping of the modifier keys. Returns true on success. | 54 // change the current mapping of the modifier keys. Returns true on success. |
| 52 virtual bool SetCurrentKeyboardLayoutByName( | 55 virtual bool SetCurrentKeyboardLayoutByName(const std::string& layout_name); |
| 53 const std::string& layout_name) = 0; | 56 |
| 57 // Gets the current keyboard layout name. | |
| 58 const std::string GetCurrentKeyboardLayoutName() { return last_layout_; } | |
| 54 | 59 |
| 55 // Sets the current keyboard layout again. We have to call the function every | 60 // Sets the current keyboard layout again. We have to call the function every |
| 56 // time when "XI_HierarchyChanged" XInput2 event is sent to Chrome. See | 61 // time when "XI_HierarchyChanged" XInput2 event is sent to Chrome. See |
| 57 // xinput_hierarchy_changed_event_listener.h for details. | 62 // xinput_hierarchy_changed_event_listener.h for details. |
| 58 virtual bool ReapplyCurrentKeyboardLayout() = 0; | 63 virtual bool ReapplyCurrentKeyboardLayout() = 0; |
| 59 | 64 |
| 60 // Updates keyboard LEDs on all keyboards. | 65 // Updates keyboard LEDs on all keyboards. |
| 61 // XKB asymmetrically propagates keyboard modifier indicator state changes to | 66 // XKB asymmetrically propagates keyboard modifier indicator state changes to |
| 62 // slave keyboards. If the state change is initiated from a client to the | 67 // slave keyboards. If the state change is initiated from a client to the |
| 63 // "core/master keyboard", XKB changes global state and pushes an indication | 68 // "core/master keyboard", XKB changes global state and pushes an indication |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 std::string last_layout_; | 119 std::string last_layout_; |
| 115 | 120 |
| 116 private: | 121 private: |
| 117 base::ObserverList<Observer> observers_; | 122 base::ObserverList<Observer> observers_; |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 } // namespace input_method | 125 } // namespace input_method |
| 121 } // namespace chromeos | 126 } // namespace chromeos |
| 122 | 127 |
| 123 #endif // UI_BASE_IME_CHROMEOS_IME_KEYBOARD_H_ | 128 #endif // UI_BASE_IME_CHROMEOS_IME_KEYBOARD_H_ |
| OLD | NEW |