Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager_impl.h

Issue 18856014: We should switch the keyboard layout to the layout the user set according to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix MockInputMethodManager build. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; 51 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE;
52 virtual void AddCandidateWindowObserver( 52 virtual void AddCandidateWindowObserver(
53 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; 53 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE;
54 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; 54 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE;
55 virtual void RemoveCandidateWindowObserver( 55 virtual void RemoveCandidateWindowObserver(
56 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; 56 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE;
57 virtual scoped_ptr<InputMethodDescriptors> 57 virtual scoped_ptr<InputMethodDescriptors>
58 GetSupportedInputMethods() const OVERRIDE; 58 GetSupportedInputMethods() const OVERRIDE;
59 virtual scoped_ptr<InputMethodDescriptors> 59 virtual scoped_ptr<InputMethodDescriptors>
60 GetActiveInputMethods() const OVERRIDE; 60 GetActiveInputMethods() const OVERRIDE;
61 virtual const std::vector<std::string>& GetActiveInputMethodIds() const
62 OVERRIDE;
61 virtual size_t GetNumActiveInputMethods() const OVERRIDE; 63 virtual size_t GetNumActiveInputMethods() const OVERRIDE;
62 virtual void EnableLayouts(const std::string& language_code, 64 virtual void EnableLayouts(const std::string& language_code,
63 const std::string& initial_layout) OVERRIDE; 65 const std::string& initial_layout) OVERRIDE;
64 virtual bool EnableInputMethods( 66 virtual bool EnableInputMethods(
65 const std::vector<std::string>& new_active_input_method_ids) OVERRIDE; 67 const std::vector<std::string>& new_active_input_method_ids) OVERRIDE;
68 virtual bool EnableInputMethod(const std::string& new_active_input_method_id)
69 OVERRIDE;
66 virtual bool MigrateOldInputMethods( 70 virtual bool MigrateOldInputMethods(
67 std::vector<std::string>* input_method_ids) OVERRIDE; 71 std::vector<std::string>* input_method_ids) OVERRIDE;
68 virtual bool MigrateKoreanKeyboard( 72 virtual bool MigrateKoreanKeyboard(
69 const std::string& keyboard_id, 73 const std::string& keyboard_id,
70 std::vector<std::string>* input_method_ids) OVERRIDE; 74 std::vector<std::string>* input_method_ids) OVERRIDE;
71 virtual bool SetInputMethodConfig( 75 virtual bool SetInputMethodConfig(
72 const std::string& section, 76 const std::string& section,
73 const std::string& config_name, 77 const std::string& config_name,
74 const InputMethodConfigValue& value) OVERRIDE; 78 const InputMethodConfigValue& value) OVERRIDE;
75 virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE; 79 virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE;
(...skipping 12 matching lines...) Expand all
88 virtual bool SwitchToNextInputMethod() OVERRIDE; 92 virtual bool SwitchToNextInputMethod() OVERRIDE;
89 virtual bool SwitchToPreviousInputMethod() OVERRIDE; 93 virtual bool SwitchToPreviousInputMethod() OVERRIDE;
90 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE; 94 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE;
91 virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE; 95 virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE;
92 virtual InputMethodPropertyList 96 virtual InputMethodPropertyList
93 GetCurrentInputMethodProperties() const OVERRIDE; 97 GetCurrentInputMethodProperties() const OVERRIDE;
94 virtual XKeyboard* GetXKeyboard() OVERRIDE; 98 virtual XKeyboard* GetXKeyboard() OVERRIDE;
95 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE; 99 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE;
96 virtual ComponentExtensionIMEManager* 100 virtual ComponentExtensionIMEManager*
97 GetComponentExtensionIMEManager() OVERRIDE; 101 GetComponentExtensionIMEManager() OVERRIDE;
102 virtual bool IsLanguageFullLatinKeyboard(const std::string& lang) const
Seigo Nonaka 2013/07/11 09:43:56 As I mentioned in crbug.com/152843, please conside
Alexander Alekseev 2013/07/12 20:10:49 It has already been discussed a bit in https://cod
103 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(
108 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); 114 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate);
109 115
116 // For fast lookup "whether this language is among
117 // listed in kFullLatinKeyboardLanguageList or not"
118 class TwoLetterLanguageCode {
119 public:
120 TwoLetterLanguageCode() : val(0) {}
121 TwoLetterLanguageCode(const char* lang);
122 bool operator<(const TwoLetterLanguageCode& r) const { return val < r.val; }
123
124 private:
125 uint16_t val;
126 };
127
110 private: 128 private:
111 // IBusController overrides: 129 // IBusController overrides:
112 virtual void PropertyChanged() OVERRIDE; 130 virtual void PropertyChanged() OVERRIDE;
113 131
114 // IBusDaemonController overrides: 132 // IBusDaemonController overrides:
115 virtual void OnConnected() OVERRIDE; 133 virtual void OnConnected() OVERRIDE;
116 virtual void OnDisconnected() OVERRIDE; 134 virtual void OnDisconnected() OVERRIDE;
117 135
118 136
119 // CandidateWindowController::Observer overrides: 137 // CandidateWindowController::Observer overrides:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 176
159 // Called when the ComponentExtensionIMEManagerDelegate is initialized. 177 // Called when the ComponentExtensionIMEManagerDelegate is initialized.
160 void OnComponentExtensionInitialized( 178 void OnComponentExtensionInitialized(
161 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); 179 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate);
162 void InitializeComponentExtension(); 180 void InitializeComponentExtension();
163 181
164 // Loads necessary component extensions. 182 // Loads necessary component extensions.
165 // TODO(nona): Support dynamical unloading. 183 // TODO(nona): Support dynamical unloading.
166 void LoadNecessaryComponentExtensions(); 184 void LoadNecessaryComponentExtensions();
167 185
186 // Adds new input method to given list if possible
187 bool EnableInputMethodImpl(
188 const std::string& input_method_id,
189 std::vector<std::string>& new_active_input_method_ids) const;
190
191 // Start or stop the system input method framework as needed.
Seigo Nonaka 2013/07/11 09:43:56 nit: Starts or stops
Alexander Alekseev 2013/07/12 20:10:49 Done.
192 // (after list of enabled input methods has been updated)
193 void ReconfigureIMFramework();
194
168 scoped_ptr<InputMethodDelegate> delegate_; 195 scoped_ptr<InputMethodDelegate> delegate_;
169 196
170 // The current browser status. 197 // The current browser status.
171 State state_; 198 State state_;
172 199
173 // A list of objects that monitor the manager. 200 // A list of objects that monitor the manager.
174 ObserverList<InputMethodManager::Observer> observers_; 201 ObserverList<InputMethodManager::Observer> observers_;
175 ObserverList<CandidateWindowObserver> candidate_window_observers_; 202 ObserverList<CandidateWindowObserver> candidate_window_observers_;
176 203
177 // The input method which was/is selected. 204 // The input method which was/is selected.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // An object for switching XKB layouts and keyboard status like caps lock and 243 // An object for switching XKB layouts and keyboard status like caps lock and
217 // auto-repeat interval. 244 // auto-repeat interval.
218 scoped_ptr<XKeyboard> xkeyboard_; 245 scoped_ptr<XKeyboard> xkeyboard_;
219 246
220 std::string pending_input_method_; 247 std::string pending_input_method_;
221 248
222 base::ThreadChecker thread_checker_; 249 base::ThreadChecker thread_checker_;
223 250
224 base::WeakPtrFactory<InputMethodManagerImpl> weak_ptr_factory_; 251 base::WeakPtrFactory<InputMethodManagerImpl> weak_ptr_factory_;
225 252
253 // Sorted vector of kFullLatinKeyboardLanguageList[] for fast lookup.
254 std::vector<TwoLetterLanguageCode> full_latin_keyboard_languages_;
255
226 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); 256 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl);
227 }; 257 };
228 258
229 } // namespace input_method 259 } // namespace input_method
230 } // namespace chromeos 260 } // namespace chromeos
231 261
232 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ 262 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698