| 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> |
| 11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" | 15 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" |
| 16 #include "chrome/browser/chromeos/input_method/ibus_controller.h" | 16 #include "chrome/browser/chromeos/input_method/ibus_controller.h" |
| 17 #include "chrome/browser/chromeos/input_method/input_method_manager_impl_ll.h" |
| 17 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 18 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 18 #include "chromeos/ime/ibus_daemon_controller.h" | 19 #include "chromeos/ime/ibus_daemon_controller.h" |
| 19 #include "chromeos/ime/input_method_manager.h" | 20 #include "chromeos/ime/input_method_manager.h" |
| 20 #include "chromeos/ime/input_method_whitelist.h" | 21 #include "chromeos/ime/input_method_whitelist.h" |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 class ComponentExtensionIMEManager; | 24 class ComponentExtensionIMEManager; |
| 24 class ComponentExtensionIMEManagerDelegate; | 25 class ComponentExtensionIMEManagerDelegate; |
| 25 class InputMethodEngineIBus; | 26 class InputMethodEngineIBus; |
| 26 namespace input_method { | 27 namespace input_method { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 51 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; | 52 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; |
| 52 virtual void AddCandidateWindowObserver( | 53 virtual void AddCandidateWindowObserver( |
| 53 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; | 54 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; |
| 54 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; | 55 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; |
| 55 virtual void RemoveCandidateWindowObserver( | 56 virtual void RemoveCandidateWindowObserver( |
| 56 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; | 57 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; |
| 57 virtual scoped_ptr<InputMethodDescriptors> | 58 virtual scoped_ptr<InputMethodDescriptors> |
| 58 GetSupportedInputMethods() const OVERRIDE; | 59 GetSupportedInputMethods() const OVERRIDE; |
| 59 virtual scoped_ptr<InputMethodDescriptors> | 60 virtual scoped_ptr<InputMethodDescriptors> |
| 60 GetActiveInputMethods() const OVERRIDE; | 61 GetActiveInputMethods() const OVERRIDE; |
| 62 virtual const std::vector<std::string>& GetActiveInputMethodIds() const |
| 63 OVERRIDE; |
| 61 virtual size_t GetNumActiveInputMethods() const OVERRIDE; | 64 virtual size_t GetNumActiveInputMethods() const OVERRIDE; |
| 62 virtual void EnableLayouts(const std::string& language_code, | 65 virtual void EnableLayouts(const std::string& language_code, |
| 63 const std::string& initial_layout) OVERRIDE; | 66 const std::string& initial_layout) OVERRIDE; |
| 64 virtual bool EnableInputMethods( | 67 virtual bool EnableInputMethods( |
| 65 const std::vector<std::string>& new_active_input_method_ids) OVERRIDE; | 68 const std::vector<std::string>& new_active_input_method_ids) OVERRIDE; |
| 69 virtual bool EnableInputMethod(const std::string& new_active_input_method_id) |
| 70 OVERRIDE; |
| 66 virtual bool MigrateOldInputMethods( | 71 virtual bool MigrateOldInputMethods( |
| 67 std::vector<std::string>* input_method_ids) OVERRIDE; | 72 std::vector<std::string>* input_method_ids) OVERRIDE; |
| 68 virtual bool MigrateKoreanKeyboard( | 73 virtual bool MigrateKoreanKeyboard( |
| 69 const std::string& keyboard_id, | 74 const std::string& keyboard_id, |
| 70 std::vector<std::string>* input_method_ids) OVERRIDE; | 75 std::vector<std::string>* input_method_ids) OVERRIDE; |
| 71 virtual bool SetInputMethodConfig( | 76 virtual bool SetInputMethodConfig( |
| 72 const std::string& section, | 77 const std::string& section, |
| 73 const std::string& config_name, | 78 const std::string& config_name, |
| 74 const InputMethodConfigValue& value) OVERRIDE; | 79 const InputMethodConfigValue& value) OVERRIDE; |
| 75 virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE; | 80 virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 virtual bool SwitchToNextInputMethod() OVERRIDE; | 93 virtual bool SwitchToNextInputMethod() OVERRIDE; |
| 89 virtual bool SwitchToPreviousInputMethod() OVERRIDE; | 94 virtual bool SwitchToPreviousInputMethod() OVERRIDE; |
| 90 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE; | 95 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE; |
| 91 virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE; | 96 virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE; |
| 92 virtual InputMethodPropertyList | 97 virtual InputMethodPropertyList |
| 93 GetCurrentInputMethodProperties() const OVERRIDE; | 98 GetCurrentInputMethodProperties() const OVERRIDE; |
| 94 virtual XKeyboard* GetXKeyboard() OVERRIDE; | 99 virtual XKeyboard* GetXKeyboard() OVERRIDE; |
| 95 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE; | 100 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE; |
| 96 virtual ComponentExtensionIMEManager* | 101 virtual ComponentExtensionIMEManager* |
| 97 GetComponentExtensionIMEManager() OVERRIDE; | 102 GetComponentExtensionIMEManager() OVERRIDE; |
| 103 virtual bool IsFullLatinKeyboard(const std::string& layout) const OVERRIDE; |
| 98 | 104 |
| 99 // Sets |ibus_controller_|. | 105 // Sets |ibus_controller_|. |
| 100 void SetIBusControllerForTesting(IBusController* ibus_controller); | 106 void SetIBusControllerForTesting(IBusController* ibus_controller); |
| 101 // Sets |candidate_window_controller_|. | 107 // Sets |candidate_window_controller_|. |
| 102 void SetCandidateWindowControllerForTesting( | 108 void SetCandidateWindowControllerForTesting( |
| 103 CandidateWindowController* candidate_window_controller); | 109 CandidateWindowController* candidate_window_controller); |
| 104 // Sets |xkeyboard_|. | 110 // Sets |xkeyboard_|. |
| 105 void SetXKeyboardForTesting(XKeyboard* xkeyboard); | 111 void SetXKeyboardForTesting(XKeyboard* xkeyboard); |
| 106 // Initialize |component_extension_manager_|. | 112 // Initialize |component_extension_manager_|. |
| 107 void InitializeComponentExtensionForTesting( | 113 void InitializeComponentExtensionForTesting( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 128 | 134 |
| 129 // Resumes the original state by activating input methods and/or changing the | 135 // Resumes the original state by activating input methods and/or changing the |
| 130 // current input method as needed. | 136 // current input method as needed. |
| 131 void OnScreenUnlocked(); | 137 void OnScreenUnlocked(); |
| 132 | 138 |
| 133 // Returns true if |input_method_id| is in |active_input_method_ids_|. | 139 // Returns true if |input_method_id| is in |active_input_method_ids_|. |
| 134 bool InputMethodIsActivated(const std::string& input_method_id); | 140 bool InputMethodIsActivated(const std::string& input_method_id); |
| 135 | 141 |
| 136 // Returns true if the given input method config value is a string list | 142 // Returns true if the given input method config value is a string list |
| 137 // that only contains an input method ID of a keyboard layout. | 143 // that only contains an input method ID of a keyboard layout. |
| 138 bool ContainOnlyKeyboardLayout(const std::vector<std::string>& value); | 144 bool ContainsOnlyKeyboardLayout(const std::vector<std::string>& value); |
| 139 | 145 |
| 140 // Returns true if the connection to ibus-daemon is established. | 146 // Returns true if the connection to ibus-daemon is established. |
| 141 bool IsIBusConnectionAlive(); | 147 bool IsIBusConnectionAlive(); |
| 142 | 148 |
| 143 // Creates and initializes |candidate_window_controller_| if it hasn't been | 149 // Creates and initializes |candidate_window_controller_| if it hasn't been |
| 144 // done. | 150 // done. |
| 145 void MaybeInitializeCandidateWindowController(); | 151 void MaybeInitializeCandidateWindowController(); |
| 146 | 152 |
| 147 // If |current_input_method_id_| is not in |input_method_ids|, switch to | 153 // If |current_input_method_id_| is not in |input_method_ids|, switch to |
| 148 // input_method_ids[0]. If the ID is equal to input_method_ids[N], switch to | 154 // input_method_ids[0]. If the ID is equal to input_method_ids[N], switch to |
| 149 // input_method_ids[N+1]. | 155 // input_method_ids[N+1]. |
| 150 void SwitchToNextInputMethodInternal( | 156 void SwitchToNextInputMethodInternal( |
| 151 const std::vector<std::string>& input_method_ids, | 157 const std::vector<std::string>& input_method_ids, |
| 152 const std::string& current_input_method_id); | 158 const std::string& current_input_method_id); |
| 153 | 159 |
| 154 // Change system input method. | 160 // Change system input method. |
| 155 // Returns true if the system input method is changed. | 161 // Returns true if the system input method is changed. |
| 156 bool ChangeInputMethodInternal(const std::string& input_method_id, | 162 bool ChangeInputMethodInternal(const std::string& input_method_id, |
| 157 bool show_message); | 163 bool show_message); |
| 158 | 164 |
| 159 // Called when the ComponentExtensionIMEManagerDelegate is initialized. | 165 // Called when the ComponentExtensionIMEManagerDelegate is initialized. |
| 160 void OnComponentExtensionInitialized( | 166 void OnComponentExtensionInitialized( |
| 161 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); | 167 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); |
| 162 void InitializeComponentExtension(); | 168 void InitializeComponentExtension(); |
| 163 | 169 |
| 164 // Loads necessary component extensions. | 170 // Loads necessary component extensions. |
| 165 // TODO(nona): Support dynamical unloading. | 171 // TODO(nona): Support dynamical unloading. |
| 166 void LoadNecessaryComponentExtensions(); | 172 void LoadNecessaryComponentExtensions(); |
| 167 | 173 |
| 174 // Adds new input method to given list if possible |
| 175 bool EnableInputMethodImpl( |
| 176 const std::string& input_method_id, |
| 177 std::vector<std::string>& new_active_input_method_ids) const; |
| 178 |
| 179 // Starts or stops the system input method framework as needed. |
| 180 // (after list of enabled input methods has been updated) |
| 181 void ReconfigureIMFramework(); |
| 182 |
| 168 scoped_ptr<InputMethodDelegate> delegate_; | 183 scoped_ptr<InputMethodDelegate> delegate_; |
| 169 | 184 |
| 170 // The current browser status. | 185 // The current browser status. |
| 171 State state_; | 186 State state_; |
| 172 | 187 |
| 173 // A list of objects that monitor the manager. | 188 // A list of objects that monitor the manager. |
| 174 ObserverList<InputMethodManager::Observer> observers_; | 189 ObserverList<InputMethodManager::Observer> observers_; |
| 175 ObserverList<CandidateWindowObserver> candidate_window_observers_; | 190 ObserverList<CandidateWindowObserver> candidate_window_observers_; |
| 176 | 191 |
| 177 // The input method which was/is selected. | 192 // The input method which was/is selected. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // An object for switching XKB layouts and keyboard status like caps lock and | 231 // An object for switching XKB layouts and keyboard status like caps lock and |
| 217 // auto-repeat interval. | 232 // auto-repeat interval. |
| 218 scoped_ptr<XKeyboard> xkeyboard_; | 233 scoped_ptr<XKeyboard> xkeyboard_; |
| 219 | 234 |
| 220 std::string pending_input_method_; | 235 std::string pending_input_method_; |
| 221 | 236 |
| 222 base::ThreadChecker thread_checker_; | 237 base::ThreadChecker thread_checker_; |
| 223 | 238 |
| 224 base::WeakPtrFactory<InputMethodManagerImpl> weak_ptr_factory_; | 239 base::WeakPtrFactory<InputMethodManagerImpl> weak_ptr_factory_; |
| 225 | 240 |
| 241 // Check if input method id allows full latin input (for entering passwords on |
| 242 // login screen) |
| 243 FullLatinKeyboardLayoutChecker full_latin_keyboard_checker; |
| 244 |
| 226 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); | 245 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); |
| 227 }; | 246 }; |
| 228 | 247 |
| 229 } // namespace input_method | 248 } // namespace input_method |
| 230 } // namespace chromeos | 249 } // namespace chromeos |
| 231 | 250 |
| 232 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ | 251 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ |
| OLD | NEW |