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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // The implementation of InputMethodManager. | 29 // The implementation of InputMethodManager. |
30 class InputMethodManagerImpl : public InputMethodManager, | 30 class InputMethodManagerImpl : public InputMethodManager, |
31 public CandidateWindowController::Observer { | 31 public CandidateWindowController::Observer { |
32 public: | 32 public: |
33 // Constructs an InputMethodManager instance. The client is responsible for | 33 // Constructs an InputMethodManager instance. The client is responsible for |
34 // calling |SetState| in response to relevant changes in browser state. | 34 // calling |SetState| in response to relevant changes in browser state. |
35 explicit InputMethodManagerImpl(scoped_ptr<InputMethodDelegate> delegate); | 35 explicit InputMethodManagerImpl(scoped_ptr<InputMethodDelegate> delegate); |
36 virtual ~InputMethodManagerImpl(); | 36 virtual ~InputMethodManagerImpl(); |
37 | 37 |
38 // Attach CandidateWindowController, and ImeKeyboard objects to the | |
39 // InputMethodManagerImpl object. You don't have to call this | |
40 // function if you attach them yourself (e.g. in unit tests) using | |
41 // the protected setters. | |
42 void Init(base::SequencedTaskRunner* ui_task_runner); | |
43 | |
44 // Receives notification of an InputMethodManager::State transition. | 38 // Receives notification of an InputMethodManager::State transition. |
45 void SetState(State new_state); | 39 void SetState(State new_state); |
46 | 40 |
47 // InputMethodManager override: | 41 // InputMethodManager override: |
| 42 virtual void InitializeComponentExtension() OVERRIDE; |
48 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; | 43 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; |
49 virtual void AddCandidateWindowObserver( | 44 virtual void AddCandidateWindowObserver( |
50 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; | 45 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; |
51 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; | 46 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; |
52 virtual void RemoveCandidateWindowObserver( | 47 virtual void RemoveCandidateWindowObserver( |
53 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; | 48 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; |
54 virtual scoped_ptr<InputMethodDescriptors> | 49 virtual scoped_ptr<InputMethodDescriptors> |
55 GetSupportedInputMethods() const OVERRIDE; | 50 GetSupportedInputMethods() const OVERRIDE; |
56 virtual scoped_ptr<InputMethodDescriptors> | 51 virtual scoped_ptr<InputMethodDescriptors> |
57 GetActiveInputMethods() const OVERRIDE; | 52 GetActiveInputMethods() const OVERRIDE; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // input_method_ids[N+1]. | 132 // input_method_ids[N+1]. |
138 void SwitchToNextInputMethodInternal( | 133 void SwitchToNextInputMethodInternal( |
139 const std::vector<std::string>& input_method_ids, | 134 const std::vector<std::string>& input_method_ids, |
140 const std::string& current_input_method_id); | 135 const std::string& current_input_method_id); |
141 | 136 |
142 // Change system input method. | 137 // Change system input method. |
143 // Returns true if the system input method is changed. | 138 // Returns true if the system input method is changed. |
144 bool ChangeInputMethodInternal(const std::string& input_method_id, | 139 bool ChangeInputMethodInternal(const std::string& input_method_id, |
145 bool show_message); | 140 bool show_message); |
146 | 141 |
147 // Gets whether the XKB extension is loaded successfully by checking the XKB | |
148 // input methods in input methods in |component_extension_ime_manager_|. | |
149 bool IsXkbComponentExtensionAvailable() const; | |
150 | |
151 // Called when the ComponentExtensionIMEManagerDelegate is initialized. | 142 // Called when the ComponentExtensionIMEManagerDelegate is initialized. |
152 void OnComponentExtensionInitialized( | 143 void OnComponentExtensionInitialized( |
153 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); | 144 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); |
154 void InitializeComponentExtension(); | |
155 | 145 |
156 // Loads necessary component extensions. | 146 // Loads necessary component extensions. |
157 // TODO(nona): Support dynamical unloading. | 147 // TODO(nona): Support dynamical unloading. |
158 void LoadNecessaryComponentExtensions(); | 148 void LoadNecessaryComponentExtensions(); |
159 | 149 |
160 // Adds new input method to given list if possible | 150 // Adds new input method to given list if possible |
161 bool EnableInputMethodImpl( | 151 bool EnableInputMethodImpl( |
162 const std::string& input_method_id, | 152 const std::string& input_method_id, |
163 std::vector<std::string>* new_active_input_method_ids) const; | 153 std::vector<std::string>* new_active_input_method_ids) const; |
164 | 154 |
(...skipping 30 matching lines...) Expand all Loading... |
195 std::vector<std::string> saved_active_input_method_ids_; | 185 std::vector<std::string> saved_active_input_method_ids_; |
196 | 186 |
197 // Extra input methods that have been explicitly added to the menu, such as | 187 // Extra input methods that have been explicitly added to the menu, such as |
198 // those created by extension. | 188 // those created by extension. |
199 std::map<std::string, InputMethodDescriptor> extra_input_methods_; | 189 std::map<std::string, InputMethodDescriptor> extra_input_methods_; |
200 | 190 |
201 // The candidate window. This will be deleted when the APP_TERMINATING | 191 // The candidate window. This will be deleted when the APP_TERMINATING |
202 // message is sent. | 192 // message is sent. |
203 scoped_ptr<CandidateWindowController> candidate_window_controller_; | 193 scoped_ptr<CandidateWindowController> candidate_window_controller_; |
204 | 194 |
205 // The object which can create an InputMethodDescriptor object. | |
206 InputMethodWhitelist whitelist_; | |
207 | |
208 // An object which provides miscellaneous input method utility functions. Note | 195 // An object which provides miscellaneous input method utility functions. Note |
209 // that |util_| is required to initialize |keyboard_|. | 196 // that |util_| is required to initialize |keyboard_|. |
210 InputMethodUtil util_; | 197 InputMethodUtil util_; |
211 | 198 |
212 // An object which provides component extension ime management functions. | 199 // An object which provides component extension ime management functions. |
213 scoped_ptr<ComponentExtensionIMEManager> component_extension_ime_manager_; | 200 scoped_ptr<ComponentExtensionIMEManager> component_extension_ime_manager_; |
214 | 201 |
215 // An object for switching XKB layouts and keyboard status like caps lock and | 202 // An object for switching XKB layouts and keyboard status like caps lock and |
216 // auto-repeat interval. | 203 // auto-repeat interval. |
217 scoped_ptr<ImeKeyboard> keyboard_; | 204 scoped_ptr<ImeKeyboard> keyboard_; |
(...skipping 11 matching lines...) Expand all Loading... |
229 typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap; | 216 typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap; |
230 ProfileEngineMap profile_engine_map_; | 217 ProfileEngineMap profile_engine_map_; |
231 | 218 |
232 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); | 219 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); |
233 }; | 220 }; |
234 | 221 |
235 } // namespace input_method | 222 } // namespace input_method |
236 } // namespace chromeos | 223 } // namespace chromeos |
237 | 224 |
238 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ | 225 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ |
OLD | NEW |