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

Unified Diff: chrome/browser/chromeos/input_method/browser_state_monitor.h

Issue 11466010: Decompose BrowserStateMonitor into two parts, simplifying unit tests and APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gypi ordering. Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/browser_state_monitor.h
diff --git a/chrome/browser/chromeos/input_method/browser_state_monitor.h b/chrome/browser/chromeos/input_method/browser_state_monitor.h
index bc3e73ab56e3ea64febbe1d029060ac64bbcf8ad..ba07af0c144ce057f6f6f59db90357d03d1da52e 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);
« no previous file with comments | « chrome/browser/chromeos/input_method/DEPS ('k') | chrome/browser/chromeos/input_method/browser_state_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698