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

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

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
18 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" 18 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h"
19 #include "chrome/browser/chromeos/input_method/input_method_util.h" 19 #include "chrome/browser/chromeos/input_method/input_method_util.h"
20 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 20 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "ui/base/ime/chromeos/input_method_manager.h" 22 #include "ui/base/ime/chromeos/input_method_manager.h"
23 #include "ui/base/ime/chromeos/input_method_whitelist.h" 23 #include "ui/base/ime/chromeos/input_method_whitelist.h"
24 #include "ui/base/ime/ime_engine_handler_interface.h" 24 #include "ui/base/ime/ime_engine_handler_interface.h"
25 25
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void RemoveInputMethodExtension(const std::string& extension_id) override; 88 void RemoveInputMethodExtension(const std::string& extension_id) override;
89 void ChangeInputMethod(const std::string& input_method_id, 89 void ChangeInputMethod(const std::string& input_method_id,
90 bool show_message) override; 90 bool show_message) override;
91 bool EnableInputMethod( 91 bool EnableInputMethod(
92 const std::string& new_active_input_method_id) override; 92 const std::string& new_active_input_method_id) override;
93 void EnableLoginLayouts( 93 void EnableLoginLayouts(
94 const std::string& language_code, 94 const std::string& language_code,
95 const std::vector<std::string>& initial_layouts) override; 95 const std::vector<std::string>& initial_layouts) override;
96 void EnableLockScreenLayouts() override; 96 void EnableLockScreenLayouts() override;
97 void GetInputMethodExtensions(InputMethodDescriptors* result) override; 97 void GetInputMethodExtensions(InputMethodDescriptors* result) override;
98 scoped_ptr<InputMethodDescriptors> GetActiveInputMethods() const override; 98 std::unique_ptr<InputMethodDescriptors> GetActiveInputMethods()
99 const override;
99 const std::vector<std::string>& GetActiveInputMethodIds() const override; 100 const std::vector<std::string>& GetActiveInputMethodIds() const override;
100 const InputMethodDescriptor* GetInputMethodFromId( 101 const InputMethodDescriptor* GetInputMethodFromId(
101 const std::string& input_method_id) const override; 102 const std::string& input_method_id) const override;
102 size_t GetNumActiveInputMethods() const override; 103 size_t GetNumActiveInputMethods() const override;
103 void SetEnabledExtensionImes(std::vector<std::string>* ids) override; 104 void SetEnabledExtensionImes(std::vector<std::string>* ids) override;
104 void SetInputMethodLoginDefault() override; 105 void SetInputMethodLoginDefault() override;
105 void SetInputMethodLoginDefaultFromVPD(const std::string& locale, 106 void SetInputMethodLoginDefaultFromVPD(const std::string& locale,
106 const std::string& layout) override; 107 const std::string& layout) override;
107 bool CanCycleInputMethod() override; 108 bool CanCycleInputMethod() override;
108 void SwitchToNextInputMethod() override; 109 void SwitchToNextInputMethod() override;
(...skipping 27 matching lines...) Expand all
136 InputMethodManagerImpl* const manager_; 137 InputMethodManagerImpl* const manager_;
137 138
138 protected: 139 protected:
139 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>; 140 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>;
140 ~StateImpl() override; 141 ~StateImpl() override;
141 }; 142 };
142 143
143 // Constructs an InputMethodManager instance. The client is responsible for 144 // Constructs an InputMethodManager instance. The client is responsible for
144 // calling |SetUISessionState| in response to relevant changes in browser 145 // calling |SetUISessionState| in response to relevant changes in browser
145 // state. 146 // state.
146 InputMethodManagerImpl(scoped_ptr<InputMethodDelegate> delegate, 147 InputMethodManagerImpl(std::unique_ptr<InputMethodDelegate> delegate,
147 bool enable_extension_loading); 148 bool enable_extension_loading);
148 ~InputMethodManagerImpl() override; 149 ~InputMethodManagerImpl() override;
149 150
150 // Receives notification of an InputMethodManager::UISessionState transition. 151 // Receives notification of an InputMethodManager::UISessionState transition.
151 void SetUISessionState(UISessionState new_ui_session); 152 void SetUISessionState(UISessionState new_ui_session);
152 153
153 // InputMethodManager override: 154 // InputMethodManager override:
154 UISessionState GetUISessionState() override; 155 UISessionState GetUISessionState() override;
155 void AddObserver(InputMethodManager::Observer* observer) override; 156 void AddObserver(InputMethodManager::Observer* observer) override;
156 void AddCandidateWindowObserver( 157 void AddCandidateWindowObserver(
157 InputMethodManager::CandidateWindowObserver* observer) override; 158 InputMethodManager::CandidateWindowObserver* observer) override;
158 void AddImeMenuObserver( 159 void AddImeMenuObserver(
159 InputMethodManager::ImeMenuObserver* observer) override; 160 InputMethodManager::ImeMenuObserver* observer) override;
160 void RemoveObserver(InputMethodManager::Observer* observer) override; 161 void RemoveObserver(InputMethodManager::Observer* observer) override;
161 void RemoveCandidateWindowObserver( 162 void RemoveCandidateWindowObserver(
162 InputMethodManager::CandidateWindowObserver* observer) override; 163 InputMethodManager::CandidateWindowObserver* observer) override;
163 void RemoveImeMenuObserver( 164 void RemoveImeMenuObserver(
164 InputMethodManager::ImeMenuObserver* observer) override; 165 InputMethodManager::ImeMenuObserver* observer) override;
165 scoped_ptr<InputMethodDescriptors> GetSupportedInputMethods() const override; 166 std::unique_ptr<InputMethodDescriptors> GetSupportedInputMethods()
167 const override;
166 void ActivateInputMethodMenuItem(const std::string& key) override; 168 void ActivateInputMethodMenuItem(const std::string& key) override;
167 bool IsISOLevel5ShiftUsedByCurrentInputMethod() const override; 169 bool IsISOLevel5ShiftUsedByCurrentInputMethod() const override;
168 bool IsAltGrUsedByCurrentInputMethod() const override; 170 bool IsAltGrUsedByCurrentInputMethod() const override;
169 void NotifyImeMenuItemsChanged( 171 void NotifyImeMenuItemsChanged(
170 const std::string& engine_id, 172 const std::string& engine_id,
171 const std::vector<InputMethodManager::MenuItem>& items) override; 173 const std::vector<InputMethodManager::MenuItem>& items) override;
172 174
173 // chromeos::UserAddingScreen: 175 // chromeos::UserAddingScreen:
174 void OnUserAddingStarted() override; 176 void OnUserAddingStarted() override;
175 void OnUserAddingFinished() override; 177 void OnUserAddingFinished() override;
(...skipping 13 matching lines...) Expand all
189 191
190 void ImeMenuActivationChanged(bool is_active) override; 192 void ImeMenuActivationChanged(bool is_active) override;
191 193
192 // Sets |candidate_window_controller_|. 194 // Sets |candidate_window_controller_|.
193 void SetCandidateWindowControllerForTesting( 195 void SetCandidateWindowControllerForTesting(
194 CandidateWindowController* candidate_window_controller); 196 CandidateWindowController* candidate_window_controller);
195 // Sets |keyboard_|. 197 // Sets |keyboard_|.
196 void SetImeKeyboardForTesting(ImeKeyboard* keyboard); 198 void SetImeKeyboardForTesting(ImeKeyboard* keyboard);
197 // Initialize |component_extension_manager_|. 199 // Initialize |component_extension_manager_|.
198 void InitializeComponentExtensionForTesting( 200 void InitializeComponentExtensionForTesting(
199 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); 201 std::unique_ptr<ComponentExtensionIMEManagerDelegate> delegate);
200 202
201 private: 203 private:
202 friend class InputMethodManagerImplTest; 204 friend class InputMethodManagerImplTest;
203 205
204 // CandidateWindowController::Observer overrides: 206 // CandidateWindowController::Observer overrides:
205 void CandidateClicked(int index) override; 207 void CandidateClicked(int index) override;
206 void CandidateWindowOpened() override; 208 void CandidateWindowOpened() override;
207 void CandidateWindowClosed() override; 209 void CandidateWindowClosed() override;
208 210
209 // Temporarily deactivates all input methods (e.g. Chinese, Japanese, Arabic) 211 // Temporarily deactivates all input methods (e.g. Chinese, Japanese, Arabic)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // If state is active, active input method is updated. 246 // If state is active, active input method is updated.
245 void ReconfigureIMFramework(StateImpl* state); 247 void ReconfigureIMFramework(StateImpl* state);
246 248
247 // Record input method usage histograms. 249 // Record input method usage histograms.
248 void RecordInputMethodUsage(const std::string& input_method_id); 250 void RecordInputMethodUsage(const std::string& input_method_id);
249 251
250 // Notifies the current input method or the list of active input method IDs 252 // Notifies the current input method or the list of active input method IDs
251 // changed. 253 // changed.
252 void NotifyImeMenuListChanged(); 254 void NotifyImeMenuListChanged();
253 255
254 scoped_ptr<InputMethodDelegate> delegate_; 256 std::unique_ptr<InputMethodDelegate> delegate_;
255 257
256 // The current UI session status. 258 // The current UI session status.
257 UISessionState ui_session_; 259 UISessionState ui_session_;
258 260
259 // A list of objects that monitor the manager. 261 // A list of objects that monitor the manager.
260 base::ObserverList<InputMethodManager::Observer> observers_; 262 base::ObserverList<InputMethodManager::Observer> observers_;
261 base::ObserverList<CandidateWindowObserver> candidate_window_observers_; 263 base::ObserverList<CandidateWindowObserver> candidate_window_observers_;
262 base::ObserverList<ImeMenuObserver> ime_menu_observers_; 264 base::ObserverList<ImeMenuObserver> ime_menu_observers_;
263 265
264 scoped_refptr<StateImpl> state_; 266 scoped_refptr<StateImpl> state_;
265 267
266 // The candidate window. This will be deleted when the APP_TERMINATING 268 // The candidate window. This will be deleted when the APP_TERMINATING
267 // message is sent. 269 // message is sent.
268 scoped_ptr<CandidateWindowController> candidate_window_controller_; 270 std::unique_ptr<CandidateWindowController> candidate_window_controller_;
269 271
270 // An object which provides miscellaneous input method utility functions. Note 272 // An object which provides miscellaneous input method utility functions. Note
271 // that |util_| is required to initialize |keyboard_|. 273 // that |util_| is required to initialize |keyboard_|.
272 InputMethodUtil util_; 274 InputMethodUtil util_;
273 275
274 // An object which provides component extension ime management functions. 276 // An object which provides component extension ime management functions.
275 scoped_ptr<ComponentExtensionIMEManager> component_extension_ime_manager_; 277 std::unique_ptr<ComponentExtensionIMEManager>
278 component_extension_ime_manager_;
276 279
277 // An object for switching XKB layouts and keyboard status like caps lock and 280 // An object for switching XKB layouts and keyboard status like caps lock and
278 // auto-repeat interval. 281 // auto-repeat interval.
279 scoped_ptr<ImeKeyboard> keyboard_; 282 std::unique_ptr<ImeKeyboard> keyboard_;
280 283
281 // Whether load IME extensions. 284 // Whether load IME extensions.
282 bool enable_extension_loading_; 285 bool enable_extension_loading_;
283 286
284 // Whether the expanded IME menu is activated. 287 // Whether the expanded IME menu is activated.
285 bool is_ime_menu_activated_; 288 bool is_ime_menu_activated_;
286 289
287 // The engine map from extension_id to an engine. 290 // The engine map from extension_id to an engine.
288 typedef std::map<std::string, ui::IMEEngineHandlerInterface*> EngineMap; 291 typedef std::map<std::string, ui::IMEEngineHandlerInterface*> EngineMap;
289 typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap; 292 typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap;
290 ProfileEngineMap engine_map_; 293 ProfileEngineMap engine_map_;
291 294
292 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); 295 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl);
293 }; 296 };
294 297
295 } // namespace input_method 298 } // namespace input_method
296 } // namespace chromeos 299 } // namespace chromeos
297 300
298 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ 301 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698