summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/input_method/browser_state_monitor.h
diff options
context:
space:
mode:
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);