Chromium Code Reviews| 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 e74f8cae4f6deaa6bbcdd4108e3f0b63b5c40386..7fe159f3b57a4abe955b04dd2b82359fee343aa3 100644 |
| --- a/chrome/browser/chromeos/input_method/browser_state_monitor.h |
| +++ b/chrome/browser/chromeos/input_method/browser_state_monitor.h |
| @@ -8,49 +8,36 @@ |
| #include <string> |
| #include "base/basictypes.h" |
| +#include "base/callback.h" |
| #include "base/compiler_specific.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. |
| + explicit BrowserStateMonitor( |
| + const base::Callback<void(InputMethodManager::State)>& observer); |
|
Seigo Nonaka
2012/12/11 04:33:04
nit: Can we pass null callback? please write comme
erikwright (departed)
2012/12/11 16:39:44
Done.
|
| 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); |