#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_BROWSER_STATE_MONITOR_H_
#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_BROWSER_STATE_MONITOR_H_
#include <string>
#include "chrome/browser/api/prefs/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"
class PrefService;
namespace chromeos {
namespace input_method {
class BrowserStateMonitor : public content::NotificationObserver,
public InputMethodManager::Observer {
public:
explicit BrowserStateMonitor(InputMethodManager* manager);
virtual ~BrowserStateMonitor();
InputMethodManager::State state() const { return state_; }
void SetPrefServiceForTesting(PrefService* pref_service);
protected:
virtual void UpdateLocalState(const std::string& current_input_method);
virtual void UpdateUserPreferences(const std::string& current_input_method);
virtual void InputMethodChanged(InputMethodManager* manager,
bool show_message) OVERRIDE;
virtual void InputMethodPropertyChanged(InputMethodManager* manager) OVERRIDE;
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
private:
void SetState(InputMethodManager::State new_state);
void InitializePrefMembers();
InputMethodManager* manager_;
InputMethodManager::State state_;
content::NotificationRegistrar notification_registrar_;
PrefService* pref_service_;
DISALLOW_COPY_AND_ASSIGN(BrowserStateMonitor);
};
}
}
#endif