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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "ui/base/ui_base_export.h" | 13 #include "ui/base/ime/ui_base_ime_export.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 namespace input_method { | 16 namespace input_method { |
17 | 17 |
18 struct AutoRepeatRate { | 18 struct AutoRepeatRate { |
19 AutoRepeatRate() : initial_delay_in_ms(0), repeat_interval_in_ms(0) {} | 19 AutoRepeatRate() : initial_delay_in_ms(0), repeat_interval_in_ms(0) {} |
20 unsigned int initial_delay_in_ms; | 20 unsigned int initial_delay_in_ms; |
21 unsigned int repeat_interval_in_ms; | 21 unsigned int repeat_interval_in_ms; |
22 }; | 22 }; |
23 | 23 |
24 enum ModifierKey { | 24 enum ModifierKey { |
25 kSearchKey = 0, // Customizable. | 25 kSearchKey = 0, // Customizable. |
26 kControlKey, // Customizable. | 26 kControlKey, // Customizable. |
27 kAltKey, // Customizable. | 27 kAltKey, // Customizable. |
28 kVoidKey, | 28 kVoidKey, |
29 kCapsLockKey, | 29 kCapsLockKey, |
30 kEscapeKey, | 30 kEscapeKey, |
31 // IMPORTANT: You should update kCustomizableKeys[] in .cc file, if you | 31 // IMPORTANT: You should update kCustomizableKeys[] in .cc file, if you |
32 // add a customizable key. | 32 // add a customizable key. |
33 kNumModifierKeys, | 33 kNumModifierKeys, |
34 }; | 34 }; |
35 | 35 |
36 class InputMethodUtil; | 36 class InputMethodUtil; |
37 | 37 |
38 class UI_BASE_EXPORT ImeKeyboard { | 38 class UI_BASE_IME_EXPORT ImeKeyboard { |
39 public: | 39 public: |
40 class Observer { | 40 class Observer { |
41 public: | 41 public: |
42 // Called when the caps lock state has changed. | 42 // Called when the caps lock state has changed. |
43 virtual void OnCapsLockChanged(bool enabled) = 0; | 43 virtual void OnCapsLockChanged(bool enabled) = 0; |
44 }; | 44 }; |
45 | 45 |
46 ImeKeyboard(); | 46 ImeKeyboard(); |
47 virtual ~ImeKeyboard(); | 47 virtual ~ImeKeyboard(); |
48 // Adds/removes observer. | 48 // Adds/removes observer. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Returns true if auto-repeat is enabled. | 94 // Returns true if auto-repeat is enabled. |
95 virtual bool GetAutoRepeatEnabled() = 0; | 95 virtual bool GetAutoRepeatEnabled() = 0; |
96 | 96 |
97 // Sets the auto-repeat rate of the keyboard, initial delay in ms, and repeat | 97 // Sets the auto-repeat rate of the keyboard, initial delay in ms, and repeat |
98 // interval in ms. Returns true on success. Do not call the function from | 98 // interval in ms. Returns true on success. Do not call the function from |
99 // non-UI threads. | 99 // non-UI threads. |
100 virtual bool SetAutoRepeatRate(const AutoRepeatRate& rate) = 0; | 100 virtual bool SetAutoRepeatRate(const AutoRepeatRate& rate) = 0; |
101 | 101 |
102 // On success, set current auto repeat rate on |out_rate| and returns true. | 102 // On success, set current auto repeat rate on |out_rate| and returns true. |
103 // Returns false otherwise. This function is protected: for testability. | 103 // Returns false otherwise. This function is protected: for testability. |
104 static UI_BASE_EXPORT bool GetAutoRepeatRateForTesting( | 104 static UI_BASE_IME_EXPORT bool GetAutoRepeatRateForTesting( |
105 AutoRepeatRate* out_rate); | 105 AutoRepeatRate* out_rate); |
106 | 106 |
107 // Returns false if |layout_name| contains a bad character. | 107 // Returns false if |layout_name| contains a bad character. |
108 static UI_BASE_EXPORT bool CheckLayoutNameForTesting( | 108 static UI_BASE_IME_EXPORT bool CheckLayoutNameForTesting( |
109 const std::string& layout_name); | 109 const std::string& layout_name); |
110 | 110 |
111 // Note: At this moment, classes other than InputMethodManager should not | 111 // Note: At this moment, classes other than InputMethodManager should not |
112 // instantiate the ImeKeyboard class. | 112 // instantiate the ImeKeyboard class. |
113 static UI_BASE_EXPORT ImeKeyboard* Create(); | 113 static UI_BASE_IME_EXPORT ImeKeyboard* Create(); |
114 | 114 |
115 bool caps_lock_is_enabled_; | 115 bool caps_lock_is_enabled_; |
116 std::string last_layout_; | 116 std::string last_layout_; |
117 | 117 |
118 private: | 118 private: |
119 ObserverList<Observer> observers_; | 119 ObserverList<Observer> observers_; |
120 }; | 120 }; |
121 | 121 |
122 } // namespace input_method | 122 } // namespace input_method |
123 } // namespace chromeos | 123 } // namespace chromeos |
124 | 124 |
125 #endif // UI_BASE_IME_CHROMEOS_IME_KEYBOARD_H_ | 125 #endif // UI_BASE_IME_CHROMEOS_IME_KEYBOARD_H_ |
OLD | NEW |