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

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

Issue 9852008: Update IME preferences outside the IME status button when Uber Tray is in use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retry Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/browser_state_monitor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_BROWSER_STATE_MONITOR_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_BROWSER_STATE_MONITOR_H_
7 #pragma once
8
9 #include <string>
10
11 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
12 #include "chrome/browser/prefs/pref_member.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "content/public/browser/notification_types.h"
16
17 namespace chromeos {
18 namespace input_method {
19
20 // A class which monitors a notification from the browser to keep track of the
21 // browser state (not logged in, logged in, etc.) and notify the current state
22 // to the input method manager. The class also updates the appropriate Chrome
23 // prefs (~/Local\ State or ~/Preferences) depending on the current browser
24 // state.
25 class BrowserStateMonitor
26 : public content::NotificationObserver,
27 public input_method::InputMethodManager::PreferenceObserver {
28 public:
29 explicit BrowserStateMonitor(InputMethodManager* manager);
30 virtual ~BrowserStateMonitor();
31
32 protected:
33 // Updates ~/Local\ State file. protected: for testing.
34 virtual void UpdateLocalState(const std::string& current_input_method);
35 // Updates ~/Preferences file. protected: for testing.
36 virtual void UpdateUserPreferences(const std::string& current_input_method);
37
38 private:
39 // InputMethodManager::PreferenceObserver implementation.
40 // TODO(yusukes): On R20, use input_method::InputMethodManager::Observer and
41 // remove the PreferenceObserver interface from InputMethodManager.
42 virtual void PreferenceUpdateNeeded(
43 input_method::InputMethodManager* manager,
44 const input_method::InputMethodDescriptor& previous_input_method,
45 const input_method::InputMethodDescriptor& current_input_method) OVERRIDE;
46 virtual void FirstObserverIsAdded(
47 input_method::InputMethodManager* manager) OVERRIDE {}
48
49 // content::NotificationObserver overrides:
50 virtual void Observe(int type,
51 const content::NotificationSource& source,
52 const content::NotificationDetails& details) OVERRIDE;
53
54 void SetState(InputMethodManager::State new_state);
55 void InitializePrefMembers();
56
57 InputMethodManager* manager_;
58 InputMethodManager::State state_;
59
60 // Objects for updating the Chrome prefs.
61 StringPrefMember previous_input_method_pref_;
62 StringPrefMember current_input_method_pref_;
63 bool initialized_;
64
65 // This is used to register this object to some browser notifications.
66 content::NotificationRegistrar notification_registrar_;
67
68 DISALLOW_COPY_AND_ASSIGN(BrowserStateMonitor);
69 };
70
71 } // namespace input_method
72 } // namespace chromeos
73
74 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_BROWSER_STATE_MONITOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/browser_state_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698