summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/input_method/browser_state_monitor.h
diff options
context:
space:
mode:
authorerikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 00:17:04 +0000
committererikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 00:17:04 +0000
commite6c1a7d3b21482fb58491b231a32bcff8666f73f (patch)
tree44de04765c7d85aeb2f94e0819ed1a87aa6e806a /chrome/browser/chromeos/input_method/browser_state_monitor.h
parent06af6a46eb2f078f8df6e241051ded35b2f1ae6e (diff)
downloadchromium_src-e6c1a7d3b21482fb58491b231a32bcff8666f73f.zip
chromium_src-e6c1a7d3b21482fb58491b231a32bcff8666f73f.tar.gz
chromium_src-e6c1a7d3b21482fb58491b231a32bcff8666f73f.tar.bz2
Decompose BrowserStateMonitor into two parts, simplifying unit tests and APIs.
Decouple InputMethodManagerImpl from content notifications by requiring the client to push said notifications. BrowserStateMonitor and InputMethodPersistence thus become part of the client (configuration layer). BUG=164375 TBR=sky Review URL: https://chromiumcodereview.appspot.com/11466010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173015 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/input_method/browser_state_monitor.h')
-rw-r--r--chrome/browser/chromeos/input_method/browser_state_monitor.h34
1 files changed, 10 insertions, 24 deletions
diff --git a/chrome/browser/chromeos/input_method/browser_state_monitor.h b/chrome/browser/chromeos/input_method/browser_state_monitor.h
index bc3e73a..ba07af0 100644
--- a/chrome/browser/chromeos/input_method/browser_state_monitor.h
+++ b/chrome/browser/chromeos/input_method/browser_state_monitor.h
@@ -8,50 +8,36 @@
#include <string>
#include "base/basictypes.h"
+#include "base/callback.h"
#include "base/compiler_specific.h"
-#include "base/prefs/public/pref_member.h"
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_types.h"
namespace chromeos {
namespace input_method {
-class InputMethodDelegate;
-
-// A class which monitors a notification from the browser to keep track of the
-// browser state (not logged in, logged in, etc.) and notify the current state
-// to the input method manager. The class also updates the appropriate Chrome
-// prefs via the InputMethodDelegate, depending on the current browser state.
-class BrowserStateMonitor : public content::NotificationObserver,
- public InputMethodManager::Observer {
+// Translates notifications from the browser (not logged in, logged in, etc.),
+// into InputMethodManager::State transitions.
+class BrowserStateMonitor : public content::NotificationObserver {
public:
- BrowserStateMonitor(InputMethodManager* manager,
- InputMethodDelegate* delegate);
+ // Constructs a monitor that will invoke the given observer callback whenever
+ // the InputMethodManager::State changes. Assumes that the current state is
+ // STATE_LOGIN_SCREEN. |observer| may be null.
+ explicit BrowserStateMonitor(
+ const base::Callback<void(InputMethodManager::State)>& observer);
virtual ~BrowserStateMonitor();
InputMethodManager::State state() const { return state_; }
- protected:
- // InputMethodManager::Observer overrides:
- virtual void InputMethodChanged(InputMethodManager* manager,
- bool show_message) OVERRIDE;
- virtual void InputMethodPropertyChanged(InputMethodManager* manager) OVERRIDE;
-
// content::NotificationObserver overrides:
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
private:
- void SetState(InputMethodManager::State new_state);
-
- InputMethodManager* manager_;
- InputMethodDelegate* delegate_;
+ base::Callback<void(InputMethodManager::State)> observer_;
InputMethodManager::State state_;
-
- // This is used to register this object to some browser notifications.
content::NotificationRegistrar notification_registrar_;
DISALLOW_COPY_AND_ASSIGN(BrowserStateMonitor);