Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / input_method / input_method_persistence.h
blob73af6d01d3a6b135306d3a6b53549ed79843520a
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_PERSISTENCE_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_PERSISTENCE_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "ui/base/ime/chromeos/input_method_manager.h"
14 class PrefService;
16 namespace chromeos {
17 namespace input_method {
19 // Observes input method and session state changes, and persists input method
20 // changes to the BrowserProcess local state or to the user preferences,
21 // according to the session state.
22 class InputMethodPersistence : public InputMethodManager::Observer {
23 public:
24 // Constructs an instance that will observe input method changes on the
25 // provided InputMethodManager. The client is responsible for calling
26 // OnSessionStateChange whenever the InputMethodManager::UISessionState
27 // changes.
28 explicit InputMethodPersistence(InputMethodManager* input_method_manager);
29 ~InputMethodPersistence() override;
31 // Receives notification of session state changes.
32 void OnSessionStateChange(InputMethodManager::UISessionState new_session);
34 // InputMethodManager::Observer overrides.
35 void InputMethodChanged(InputMethodManager* manager,
36 Profile* profile,
37 bool show_message) override;
39 private:
40 InputMethodManager* input_method_manager_;
41 InputMethodManager::UISessionState ui_session_;
42 DISALLOW_COPY_AND_ASSIGN(InputMethodPersistence);
45 void SetUserLRUInputMethodPreferenceForTesting(const std::string& username,
46 const std::string& input_method,
47 PrefService* local_state);
49 } // namespace input_method
50 } // namespace chromeos
52 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_PERSISTENCE_H_