OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const std::string& layout) override; | 106 const std::string& layout) override; |
107 bool CanCycleInputMethod() override; | 107 bool CanCycleInputMethod() override; |
108 void SwitchToNextInputMethod() override; | 108 void SwitchToNextInputMethod() override; |
109 void SwitchToPreviousInputMethod() override; | 109 void SwitchToPreviousInputMethod() override; |
110 bool CanSwitchInputMethod(const ui::Accelerator& accelerator) override; | 110 bool CanSwitchInputMethod(const ui::Accelerator& accelerator) override; |
111 void SwitchInputMethod(const ui::Accelerator& accelerator) override; | 111 void SwitchInputMethod(const ui::Accelerator& accelerator) override; |
112 InputMethodDescriptor GetCurrentInputMethod() const override; | 112 InputMethodDescriptor GetCurrentInputMethod() const override; |
113 bool ReplaceEnabledInputMethods( | 113 bool ReplaceEnabledInputMethods( |
114 const std::vector<std::string>& new_active_input_method_ids) override; | 114 const std::vector<std::string>& new_active_input_method_ids) override; |
115 | 115 |
| 116 bool SetAllowedKeyboardLayoutInputMethods( |
| 117 const std::vector<std::string>& new_allowed_input_method_ids) override; |
| 118 const std::vector<std::string>& GetAllowedKeyboardLayoutInputMethods() |
| 119 override; |
| 120 |
116 // ------------------------- Data members. | 121 // ------------------------- Data members. |
117 Profile* const profile; | 122 Profile* const profile; |
118 | 123 |
119 // The input method which was/is selected. | 124 // The input method which was/is selected. |
120 InputMethodDescriptor previous_input_method; | 125 InputMethodDescriptor previous_input_method; |
121 InputMethodDescriptor current_input_method; | 126 InputMethodDescriptor current_input_method; |
122 | 127 |
123 // The active input method ids cache. | 128 // The active input method ids cache. |
124 std::vector<std::string> active_input_method_ids; | 129 std::vector<std::string> active_input_method_ids; |
125 | 130 |
| 131 // The allowed keyboard layout input methods (e.g. by policy). |
| 132 std::vector<std::string> allowed_keyboard_layout_input_method_ids; |
| 133 |
126 // The pending input method id for delayed 3rd party IME enabling. | 134 // The pending input method id for delayed 3rd party IME enabling. |
127 std::string pending_input_method_id; | 135 std::string pending_input_method_id; |
128 | 136 |
129 // The list of enabled extension IMEs. | 137 // The list of enabled extension IMEs. |
130 std::vector<std::string> enabled_extension_imes; | 138 std::vector<std::string> enabled_extension_imes; |
131 | 139 |
132 // Extra input methods that have been explicitly added to the menu, such as | 140 // Extra input methods that have been explicitly added to the menu, such as |
133 // those created by extension. | 141 // those created by extension. |
134 std::map<std::string, InputMethodDescriptor> extra_input_methods; | 142 std::map<std::string, InputMethodDescriptor> extra_input_methods; |
135 | 143 |
136 InputMethodManagerImpl* const manager_; | 144 InputMethodManagerImpl* const manager_; |
137 | 145 |
138 // True if the opt-in IME menu is activated. | 146 // True if the opt-in IME menu is activated. |
139 bool menu_activated; | 147 bool menu_activated; |
140 | 148 |
141 protected: | 149 protected: |
142 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>; | 150 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>; |
143 ~StateImpl() override; | 151 ~StateImpl() override; |
| 152 |
| 153 private: |
| 154 // Retruns true if the passed input method is allowed. By default, all input |
| 155 // methods are allowed. After SetAllowedKeyboardLayoutInputMethods was |
| 156 // called, the passed keyboard layout input methods are allowed and all |
| 157 // non-keyboard input methods remain to be allowed. |
| 158 bool IsInputMethodAllowed(const std::string& input_method_id) const; |
144 }; | 159 }; |
145 | 160 |
146 // Constructs an InputMethodManager instance. The client is responsible for | 161 // Constructs an InputMethodManager instance. The client is responsible for |
147 // calling |SetUISessionState| in response to relevant changes in browser | 162 // calling |SetUISessionState| in response to relevant changes in browser |
148 // state. | 163 // state. |
149 InputMethodManagerImpl(std::unique_ptr<InputMethodDelegate> delegate, | 164 InputMethodManagerImpl(std::unique_ptr<InputMethodDelegate> delegate, |
150 bool enable_extension_loading); | 165 bool enable_extension_loading); |
151 ~InputMethodManagerImpl() override; | 166 ~InputMethodManagerImpl() override; |
152 | 167 |
153 // Receives notification of an InputMethodManager::UISessionState transition. | 168 // Receives notification of an InputMethodManager::UISessionState transition. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap; | 312 typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap; |
298 ProfileEngineMap engine_map_; | 313 ProfileEngineMap engine_map_; |
299 | 314 |
300 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); | 315 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); |
301 }; | 316 }; |
302 | 317 |
303 } // namespace input_method | 318 } // namespace input_method |
304 } // namespace chromeos | 319 } // namespace chromeos |
305 | 320 |
306 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ | 321 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ |
OLD | NEW |