summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-04 06:40:44 +0000
committeryusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-04 06:40:44 +0000
commit5e3634aab3695aa484ef5e2a4e496aad8966ed35 (patch)
tree087d05eb1e6f00dfb686485bcfbd03a80acc0b45
parentfb078af51276e07e9747c678be7438be7ee38c0e (diff)
downloadchromium_src-5e3634aab3695aa484ef5e2a4e496aad8966ed35.zip
chromium_src-5e3634aab3695aa484ef5e2a4e496aad8966ed35.tar.gz
chromium_src-5e3634aab3695aa484ef5e2a4e496aad8966ed35.tar.bz2
* Remove all Preference code from InputMethodMenu. Always handle IME preferences in BrowserStateMonitor and Preferences regardless of the uber tray flag.
* Remove PreferenceObserver from InputMethodManager. * Use Observer instead of PreferenceObserver in BrowserStateMonitor. BUG=chromiun-os:28297 TEST=manual Review URL: https://chromiumcodereview.appspot.com/9838095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130564 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/input_method/browser_state_monitor.cc23
-rw-r--r--chrome/browser/chromeos/input_method/browser_state_monitor.h23
-rw-r--r--chrome/browser/chromeos/input_method/input_method_manager.cc52
-rw-r--r--chrome/browser/chromeos/input_method/input_method_manager.h22
-rw-r--r--chrome/browser/chromeos/preferences.cc4
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.cc155
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.h42
7 files changed, 34 insertions, 287 deletions
diff --git a/chrome/browser/chromeos/input_method/browser_state_monitor.cc b/chrome/browser/chromeos/input_method/browser_state_monitor.cc
index cc5636e..c2528f1 100644
--- a/chrome/browser/chromeos/input_method/browser_state_monitor.cc
+++ b/chrome/browser/chromeos/input_method/browser_state_monitor.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/chromeos/input_method/browser_state_monitor.h"
-#include "ash/ash_switches.h"
-#include "base/command_line.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/chromeos/language_preferences.h"
@@ -32,13 +30,6 @@ BrowserStateMonitor::BrowserStateMonitor(InputMethodManager* manager)
: manager_(manager),
state_(InputMethodManager::STATE_LOGIN_SCREEN),
initialized_(false) {
- // On R19, when Uber Tray is disabled, the IME status button will update the
- // Preferences.
- // TODO(yusukes): Remove all Preferences code from the button on R20.
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kDisableAshUberTray))
- return;
-
notification_registrar_.Add(this,
chrome::NOTIFICATION_LOGIN_USER_CHANGED,
content::NotificationService::AllSources());
@@ -55,13 +46,11 @@ BrowserStateMonitor::BrowserStateMonitor(InputMethodManager* manager)
content::NotificationService::AllSources());
// TODO(yusukes): Tell the initial state to the manager.
- manager_->AddPreLoginPreferenceObserver(this);
- manager_->AddPostLoginPreferenceObserver(this);
+ manager_->AddObserver(this);
}
BrowserStateMonitor::~BrowserStateMonitor() {
- manager_->RemovePostLoginPreferenceObserver(this);
- manager_->RemovePreLoginPreferenceObserver(this);
+ manager_->RemoveObserver(this);
}
void BrowserStateMonitor::UpdateLocalState(
@@ -91,10 +80,10 @@ void BrowserStateMonitor::UpdateUserPreferences(
current_input_method_pref_.SetValue(current_input_method);
}
-void BrowserStateMonitor::PreferenceUpdateNeeded(
- input_method::InputMethodManager* manager,
- const input_method::InputMethodDescriptor& previous_input_method,
- const input_method::InputMethodDescriptor& current_input_method) {
+void BrowserStateMonitor::InputMethodChanged(
+ InputMethodManager* manager,
+ const InputMethodDescriptor& current_input_method,
+ size_t num_active_input_methods) {
DCHECK_EQ(manager_, manager);
// Save the new input method id depending on the current browser state.
switch (state_) {
diff --git a/chrome/browser/chromeos/input_method/browser_state_monitor.h b/chrome/browser/chromeos/input_method/browser_state_monitor.h
index bd7f01b..4512b98 100644
--- a/chrome/browser/chromeos/input_method/browser_state_monitor.h
+++ b/chrome/browser/chromeos/input_method/browser_state_monitor.h
@@ -24,7 +24,7 @@ namespace input_method {
// state.
class BrowserStateMonitor
: public content::NotificationObserver,
- public input_method::InputMethodManager::PreferenceObserver {
+ public input_method::InputMethodManager::Observer {
public:
explicit BrowserStateMonitor(InputMethodManager* manager);
virtual ~BrowserStateMonitor();
@@ -36,15 +36,18 @@ class BrowserStateMonitor
virtual void UpdateUserPreferences(const std::string& current_input_method);
private:
- // InputMethodManager::PreferenceObserver implementation.
- // TODO(yusukes): On R20, use input_method::InputMethodManager::Observer and
- // remove the PreferenceObserver interface from InputMethodManager.
- virtual void PreferenceUpdateNeeded(
- input_method::InputMethodManager* manager,
- const input_method::InputMethodDescriptor& previous_input_method,
- const input_method::InputMethodDescriptor& current_input_method) OVERRIDE;
- virtual void FirstObserverIsAdded(
- input_method::InputMethodManager* manager) OVERRIDE {}
+ // InputMethodManager::Observer implementation.
+ virtual void InputMethodChanged(
+ InputMethodManager* manager,
+ const InputMethodDescriptor& current_input_method,
+ size_t num_active_input_methods) OVERRIDE;
+ virtual void ActiveInputMethodsChanged(
+ InputMethodManager* manager,
+ const InputMethodDescriptor& current_input_method,
+ size_t num_active_input_methods) OVERRIDE {}
+ virtual void PropertyListChanged(
+ InputMethodManager* manager,
+ const InputMethodPropertyList& current_ime_properties) OVERRIDE {}
// content::NotificationObserver overrides:
virtual void Observe(int type,
diff --git a/chrome/browser/chromeos/input_method/input_method_manager.cc b/chrome/browser/chromeos/input_method/input_method_manager.cc
index 9887c49..7b0f302 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager.cc
@@ -132,32 +132,6 @@ class InputMethodManagerImpl : public InputMethodManager,
candidate_window_observers_.RemoveObserver(observer);
}
- virtual void AddPreLoginPreferenceObserver(
- InputMethodManager::PreferenceObserver* observer) {
- if (!pre_login_preference_observers_.size()) {
- observer->FirstObserverIsAdded(this);
- }
- pre_login_preference_observers_.AddObserver(observer);
- }
-
- virtual void RemovePreLoginPreferenceObserver(
- InputMethodManager::PreferenceObserver* observer) {
- pre_login_preference_observers_.RemoveObserver(observer);
- }
-
- virtual void AddPostLoginPreferenceObserver(
- InputMethodManager::PreferenceObserver* observer) {
- if (!post_login_preference_observers_.size()) {
- observer->FirstObserverIsAdded(this);
- }
- post_login_preference_observers_.AddObserver(observer);
- }
-
- virtual void RemovePostLoginPreferenceObserver(
- InputMethodManager::PreferenceObserver* observer) {
- post_login_preference_observers_.RemoveObserver(observer);
- }
-
virtual void AddVirtualKeyboardObserver(VirtualKeyboardObserver* observer) {
virtual_keyboard_observers_.AddObserver(observer);
}
@@ -910,23 +884,6 @@ class InputMethodManagerImpl : public InputMethodManager,
}
}
- // Ask the first observer to update preferences. We should not ask every
- // observer to do so. Otherwise, we'll end up updating preferences many times
- // when many observers are attached (ex. many windows are opened), which is
- // unnecessary and expensive.
- bool UpdateInputMethodPreference(
- ObserverList<PreferenceObserver>* observers) {
- ObserverListBase<PreferenceObserver>::Iterator it(*observers);
- PreferenceObserver* first_observer = it.GetNext();
- if (!first_observer) {
- return false;
- }
- first_observer->PreferenceUpdateNeeded(this,
- previous_input_method_,
- current_input_method_);
- return true;
- }
-
// Changes the current input method from the given input method
// descriptor. This function updates states like current_input_method_
// and notifies observers about the change (that will update the
@@ -943,13 +900,6 @@ class InputMethodManagerImpl : public InputMethodManager,
LOG(ERROR) << "Failed to change keyboard layout to "
<< current_input_method_.keyboard_layout();
}
-
- // Save the input method names to the Pref.
- if (!UpdateInputMethodPreference(&post_login_preference_observers_)) {
- // When both pre- and post-login observers are available, only notifies
- // the latter one.
- UpdateInputMethodPreference(&pre_login_preference_observers_);
- }
}
// Update input method indicators (e.g. "US", "DV") in Chrome windows.
@@ -1226,8 +1176,6 @@ class InputMethodManagerImpl : public InputMethodManager,
ObserverList<InputMethodManager::Observer> observers_;
ObserverList<InputMethodManager::CandidateWindowObserver>
candidate_window_observers_;
- ObserverList<PreferenceObserver> pre_login_preference_observers_;
- ObserverList<PreferenceObserver> post_login_preference_observers_;
ObserverList<VirtualKeyboardObserver> virtual_keyboard_observers_;
// The input method which was/is selected.
diff --git a/chrome/browser/chromeos/input_method/input_method_manager.h b/chrome/browser/chromeos/input_method/input_method_manager.h
index d12d3d6d..b9367f7 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager.h
+++ b/chrome/browser/chromeos/input_method/input_method_manager.h
@@ -60,12 +60,14 @@ class InputMethodManager {
size_t num_active_input_methods) = 0;
// Called when the active input methods are changed.
+ // TODO(yusukes): Remove this method in R20.
virtual void ActiveInputMethodsChanged(
InputMethodManager* manager,
const InputMethodDescriptor& current_input_method,
size_t num_active_input_methods) = 0;
// Called when the list of properties is changed.
+ // TODO(yusukes): Remove this method in R20.
virtual void PropertyListChanged(
InputMethodManager* manager,
const InputMethodPropertyList& current_ime_properties) = 0;
@@ -87,20 +89,6 @@ class InputMethodManager {
virtual void CandidateWindowClosed(InputMethodManager* manager) = 0;
};
- class PreferenceObserver {
- public:
- virtual ~PreferenceObserver() {}
-
- // Called when the preferences have to be updated.
- virtual void PreferenceUpdateNeeded(
- InputMethodManager* manager,
- const InputMethodDescriptor& previous_input_method,
- const InputMethodDescriptor& current_input_method) = 0;
-
- // Called by AddObserver() when the first observer is added.
- virtual void FirstObserverIsAdded(InputMethodManager* obj) = 0;
- };
-
class VirtualKeyboardObserver {
public:
virtual ~VirtualKeyboardObserver() {}
@@ -120,17 +108,11 @@ class InputMethodManager {
virtual void AddObserver(Observer* observer) = 0;
virtual void AddCandidateWindowObserver(
CandidateWindowObserver* observer) = 0;
- virtual void AddPreLoginPreferenceObserver(PreferenceObserver* observer) = 0;
- virtual void AddPostLoginPreferenceObserver(PreferenceObserver* observer) = 0;
virtual void AddVirtualKeyboardObserver(
VirtualKeyboardObserver* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;
virtual void RemoveCandidateWindowObserver(
CandidateWindowObserver* observer) = 0;
- virtual void RemovePreLoginPreferenceObserver(
- PreferenceObserver* observer) = 0;
- virtual void RemovePostLoginPreferenceObserver(
- PreferenceObserver* observer) = 0;
virtual void RemoveVirtualKeyboardObserver(
VirtualKeyboardObserver* observer) = 0;
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index ede7d19..30509bc 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/chromeos/preferences.h"
-#include "ash/ash_switches.h"
#include "base/chromeos/chromeos_version.h"
#include "base/command_line.h"
#include "base/i18n/time_formatting.h"
@@ -446,8 +445,7 @@ void Preferences::NotifyPrefChanged(const std::string* pref_name) {
// Do not check |*pref_name| for the two prefs. We're only interested in
// initial values of the prefs.
// TODO(yusukes): Remove the second condition on R20.
- if (!pref_name && !CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kDisableAshUberTray)) {
+ if (!pref_name) {
const std::string previous_input_method_id =
previous_input_method_.GetValue();
const std::string current_input_method_id =
diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc
index f27db8c..886458c 100644
--- a/chrome/browser/chromeos/status/input_method_menu.cc
+++ b/chrome/browser/chromeos/status/input_method_menu.cc
@@ -13,14 +13,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
-#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/pref_names.h"
-#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -91,13 +84,6 @@ string16 GetLanguageName(const std::string& language_code) {
return language_name;
}
-PrefService* GetPrefService() {
- Profile* profile = ProfileManager::GetDefaultProfile();
- if (profile)
- return profile->GetPrefs();
- return NULL;
-}
-
} // namespace
namespace chromeos {
@@ -108,10 +94,8 @@ using input_method::InputMethodManager;
// InputMethodMenu
InputMethodMenu::InputMethodMenu()
- : initialized_prefs_(false),
- initialized_observers_(false),
- input_method_descriptors_(InputMethodManager::GetInstance()->
- GetActiveInputMethods()),
+ : input_method_descriptors_(
+ InputMethodManager::GetInstance()->GetActiveInputMethods()),
model_(new ui::SimpleMenuModel(NULL)),
ALLOW_THIS_IN_INITIALIZER_LIST(input_method_menu_delegate_(
new views::MenuModelAdapter(this))),
@@ -122,33 +106,13 @@ InputMethodMenu::InputMethodMenu()
menu_alignment_(views::MenuItemView::TOPRIGHT) {
DCHECK(input_method_descriptors_.get() &&
!input_method_descriptors_->empty());
-
- // Sync current and previous input methods on Chrome prefs with ibus-daemon.
- if (StatusAreaViewChromeos::IsBrowserMode())
- InitializePrefMembers();
-
- if (StatusAreaViewChromeos::IsLoginMode()) {
- registrar_.Add(this,
- chrome::NOTIFICATION_LOGIN_USER_CHANGED,
- content::NotificationService::AllSources());
- // On Aura status area is not recreated on sign in. Instead, 2 notifications
- // are sent to Chrome on sign in: NOTIFICATION_LOGIN_USER_CHANGED with
- // StatusAreaViewChromeos::IsLoginMode() and NOTIFICATION_SESSION_STARTED
- // with StatusAreaViewChromeos::IsBrowserMode().
- // In case of Chrome crash, Chrome will be reloaded but IsLoginMode() will
- // return false at this point so NOTIFICATION_SESSION_STARTED will be
- // ignored and all initialization will happen in ctor.
- registrar_.Add(this,
- chrome::NOTIFICATION_SESSION_STARTED,
- content::NotificationService::AllSources());
- }
- AddObservers();
+ AddObserver();
}
InputMethodMenu::~InputMethodMenu() {
- // RemoveObservers() is no-op if |this| object is already removed from the
+ // RemoveObserver() is no-op if |this| object is already removed from the
// observer list
- RemoveObservers();
+ RemoveObserver();
}
////////////////////////////////////////////////////////////////////////////////
@@ -177,7 +141,7 @@ bool InputMethodMenu::IsItemCheckedAt(int index) const {
const input_method::InputMethodDescriptor& input_method
= input_method_descriptors_->at(index);
return input_method == InputMethodManager::GetInstance()->
- GetCurrentInputMethod();
+ GetCurrentInputMethod();
}
if (GetPropertyIndex(index, &index)) {
@@ -380,25 +344,6 @@ void InputMethodMenu::InputMethodChanged(
UpdateUIFromInputMethod(current_input_method, num_active_input_methods);
}
-// TODO(yusukes): Move code for handling preferences to chromeos/input_method/.
-void InputMethodMenu::PreferenceUpdateNeeded(
- InputMethodManager* manager,
- const input_method::InputMethodDescriptor& previous_input_method,
- const input_method::InputMethodDescriptor& current_input_method) {
- if (StatusAreaViewChromeos::IsBrowserMode()) {
- if (initialized_prefs_) { // make sure we're not in unit tests.
- // Sometimes (e.g. initial boot) |previous_input_method.id()| is empty.
- previous_input_method_pref_.SetValue(previous_input_method.id());
- current_input_method_pref_.SetValue(current_input_method.id());
- }
- } else if (StatusAreaViewChromeos::IsLoginMode()) {
- if (g_browser_process && g_browser_process->local_state()) {
- g_browser_process->local_state()->SetString(
- language_prefs::kPreferredKeyboardLayout, current_input_method.id());
- }
- }
-}
-
void InputMethodMenu::PropertyListChanged(
InputMethodManager* manager,
const input_method::InputMethodPropertyList& current_ime_properties) {
@@ -422,29 +367,6 @@ void InputMethodMenu::PropertyListChanged(
}
}
-void InputMethodMenu::FirstObserverIsAdded(InputMethodManager* manager) {
- // NOTICE: Since this function might be called from the constructor of this
- // class, it's better to avoid calling virtual functions.
-
- if (initialized_prefs_ && StatusAreaViewChromeos::IsBrowserMode()) {
- // Get the input method name in the Preferences file which was in use last
- // time, and switch to the method. We remember two input method names in the
- // preference so that the Control+space hot-key could work fine from the
- // beginning. InputMethodChanged() will be called soon and the indicator
- // will be updated.
- const std::string previous_input_method_id =
- previous_input_method_pref_.GetValue();
- if (!previous_input_method_id.empty()) {
- manager->ChangeInputMethod(previous_input_method_id);
- }
- const std::string current_input_method_id =
- current_input_method_pref_.GetValue();
- if (!current_input_method_id.empty()) {
- manager->ChangeInputMethod(current_input_method_id);
- }
- }
-}
-
void InputMethodMenu::PrepareForMenuOpen() {
content::RecordAction(UserMetricsAction("LanguageMenuButton_Open"));
PrepareMenuModel();
@@ -597,80 +519,19 @@ string16 InputMethodMenu::GetTextForMenu(
return text;
}
-void InputMethodMenu::RegisterPrefs(PrefService* local_state) {
- // We use an empty string here rather than a hardware keyboard layout name
- // since input_method::GetHardwareInputMethodId() might return a fallback
- // layout name if local_state->RegisterStringPref(kHardwareKeyboardLayout)
- // is not called yet.
- local_state->RegisterStringPref(language_prefs::kPreferredKeyboardLayout,
- "",
- PrefService::UNSYNCABLE_PREF);
-}
-
-void InputMethodMenu::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
- // When a user logs in, we should remove |this| object from the observer
- // list so that PreferenceUpdateNeeded() does not update the local state
- // anymore.
- RemoveObservers();
- }
- if (type == chrome::NOTIFICATION_SESSION_STARTED) {
- InitializePrefMembers();
- AddObservers();
- InputMethodManager* manager = InputMethodManager::GetInstance();
- UpdateUIFromInputMethod(manager->GetCurrentInputMethod(),
- manager->GetNumActiveInputMethods());
- }
-}
-
void InputMethodMenu::SetMinimumWidth(int width) {
// On the OOBE network selection screen, fixed width menu would be preferable.
minimum_input_method_menu_width_ = width;
}
-void InputMethodMenu::AddObservers() {
- if (initialized_observers_)
- return;
+void InputMethodMenu::AddObserver() {
InputMethodManager* manager = InputMethodManager::GetInstance();
- if (StatusAreaViewChromeos::IsLoginMode()) {
- manager->AddPreLoginPreferenceObserver(this);
- } else if (StatusAreaViewChromeos::IsBrowserMode()) {
- manager->AddPostLoginPreferenceObserver(this);
- }
- // AddObserver() should be called after AddXXXLoginPreferenceObserver. This is
- // because when the function is called FirstObserverIsAdded might be called
- // back, and FirstObserverIsAdded might then might call ChangeInputMethod() in
- // InputMethodManager. We have to prevent the manager function from calling
- // callback functions like InputMethodChanged since they touch (yet
- // uninitialized) UI elements.
manager->AddObserver(this);
- initialized_observers_ = true;
}
-void InputMethodMenu::RemoveObservers() {
+void InputMethodMenu::RemoveObserver() {
InputMethodManager* manager = InputMethodManager::GetInstance();
- if (StatusAreaViewChromeos::IsLoginMode()) {
- manager->RemovePreLoginPreferenceObserver(this);
- } else if (StatusAreaViewChromeos::IsBrowserMode()) {
- manager->RemovePostLoginPreferenceObserver(this);
- }
manager->RemoveObserver(this);
- initialized_observers_ = false;
-}
-
-void InputMethodMenu::InitializePrefMembers() {
- if (!initialized_prefs_) {
- PrefService* pref_service = GetPrefService();
- if (pref_service) {
- initialized_prefs_ = true;
- previous_input_method_pref_.Init(
- prefs::kLanguagePreviousInputMethod, pref_service, this);
- current_input_method_pref_.Init(
- prefs::kLanguageCurrentInputMethod, pref_service, this);
- }
- }
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/input_method_menu.h b/chrome/browser/chromeos/status/input_method_menu.h
index 93c789b..3658a20 100644
--- a/chrome/browser/chromeos/status/input_method_menu.h
+++ b/chrome/browser/chromeos/status/input_method_menu.h
@@ -10,10 +10,6 @@
#include "base/compiler_specific.h"
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_types.h"
#include "ui/base/models/menu_model.h"
#include "ui/views/controls/button/menu_button_listener.h"
#include "ui/views/controls/menu/menu_item_view.h"
@@ -40,9 +36,7 @@ namespace chromeos {
class InputMethodMenu
: public views::MenuButtonListener,
public ui::MenuModel,
- public input_method::InputMethodManager::Observer,
- public input_method::InputMethodManager::PreferenceObserver,
- public content::NotificationObserver {
+ public input_method::InputMethodManager::Observer {
public:
InputMethodMenu();
virtual ~InputMethodMenu();
@@ -85,19 +79,6 @@ class InputMethodMenu
input_method::InputMethodManager* manager,
const input_method::InputMethodPropertyList& properties) OVERRIDE;
- // InputMethodManager::PreferenceObserver implementation.
- virtual void PreferenceUpdateNeeded(
- input_method::InputMethodManager* manager,
- const input_method::InputMethodDescriptor& previous_input_method,
- const input_method::InputMethodDescriptor& current_input_method) OVERRIDE;
- virtual void FirstObserverIsAdded(
- input_method::InputMethodManager* manager) OVERRIDE;
-
- // content::NotificationObserver implementation.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
// Specify menu alignment (default TOPRIGHT).
void set_menu_alignment(views::MenuItemView::AnchorPosition menu_alignment) {
menu_alignment_ = menu_alignment;
@@ -109,9 +90,6 @@ class InputMethodMenu
// Rebuilds menu model.
void PrepareMenuModel();
- // Registers input method preferences for the login screen.
- static void RegisterPrefs(PrefService* local_state);
-
// Returns a string for the drop-down menu and the tooltip for the indicator.
// The method is public for unit tests.
static string16 GetTextForMenu(
@@ -160,23 +138,13 @@ class InputMethodMenu
// item.
bool IndexPointsToConfigureImeMenuItem(int index) const;
- // Add / Remove InputMethodManager observers.
- void AddObservers();
- void RemoveObservers();
-
- // Initializes objects for reading/writing Chrome prefs.
- void InitializePrefMembers();
-
- bool initialized_prefs_;
- bool initialized_observers_;
+ // Add / Remove InputMethodManager observer.
+ void AddObserver();
+ void RemoveObserver();
// The current input method list.
scoped_ptr<input_method::InputMethodDescriptors> input_method_descriptors_;
- // Objects for reading/writing the Chrome prefs.
- StringPrefMember previous_input_method_pref_;
- StringPrefMember current_input_method_pref_;
-
// We borrow ui::SimpleMenuModel implementation to maintain the current
// content of the pop-up menu. The ui::MenuModel is implemented using this
// |model_|. The MenuModelAdapter wraps the model with the
@@ -191,8 +159,6 @@ class InputMethodMenu
// Menu alignment (default TOPRIGHT).
views::MenuItemView::AnchorPosition menu_alignment_;
- content::NotificationRegistrar registrar_;
-
DISALLOW_COPY_AND_ASSIGN(InputMethodMenu);
};