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_PERSISTENCE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_PERSISTENCE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_PERSISTENCE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_PERSISTENCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chromeos/ime/input_method_manager.h" | 12 #include "chromeos/ime/input_method_manager.h" |
13 | 13 |
| 14 class PrefService; |
| 15 |
14 namespace chromeos { | 16 namespace chromeos { |
15 namespace input_method { | 17 namespace input_method { |
16 | 18 |
17 // Observes input method and session state changes, and persists input method | 19 // Observes input method and session state changes, and persists input method |
18 // changes to the BrowserProcess local state or to the user preferences, | 20 // changes to the BrowserProcess local state or to the user preferences, |
19 // according to the session state. | 21 // according to the session state. |
20 class InputMethodPersistence : public InputMethodManager::Observer { | 22 class InputMethodPersistence : public InputMethodManager::Observer { |
21 public: | 23 public: |
22 // Constructs an instance that will observe input method changes on the | 24 // Constructs an instance that will observe input method changes on the |
23 // provided InputMethodManager. The client is responsible for calling | 25 // provided InputMethodManager. The client is responsible for calling |
24 // OnSessionStateChange whenever the InputMethodManager::UISessionState | 26 // OnSessionStateChange whenever the InputMethodManager::UISessionState |
25 // changes. | 27 // changes. |
26 explicit InputMethodPersistence(InputMethodManager* input_method_manager); | 28 explicit InputMethodPersistence(InputMethodManager* input_method_manager); |
27 virtual ~InputMethodPersistence(); | 29 virtual ~InputMethodPersistence(); |
28 | 30 |
29 // Receives notification of session state changes. | 31 // Receives notification of session state changes. |
30 void OnSessionStateChange(InputMethodManager::UISessionState new_session); | 32 void OnSessionStateChange(InputMethodManager::UISessionState new_session); |
31 | 33 |
32 // InputMethodManager::Observer overrides. | 34 // InputMethodManager::Observer overrides. |
33 virtual void InputMethodChanged(InputMethodManager* manager, | 35 virtual void InputMethodChanged(InputMethodManager* manager, |
34 bool show_message) OVERRIDE; | 36 bool show_message) OVERRIDE; |
35 | 37 |
36 private: | 38 private: |
37 InputMethodManager* input_method_manager_; | 39 InputMethodManager* input_method_manager_; |
38 InputMethodManager::UISessionState ui_session_; | 40 InputMethodManager::UISessionState ui_session_; |
39 DISALLOW_COPY_AND_ASSIGN(InputMethodPersistence); | 41 DISALLOW_COPY_AND_ASSIGN(InputMethodPersistence); |
40 }; | 42 }; |
41 | 43 |
| 44 void SetUserLRUInputMethodPreferenceForTesting(const std::string& username, |
| 45 const std::string& input_method, |
| 46 PrefService* local_state); |
| 47 |
42 } // namespace input_method | 48 } // namespace input_method |
43 } // namespace chromeos | 49 } // namespace chromeos |
44 | 50 |
45 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_PERSISTENCE_H_ | 51 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_PERSISTENCE_H_ |
OLD | NEW |