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

Unified Diff: chrome/browser/chromeos/status/input_method_menu.cc

Issue 4162002: Reduce CPU usage for input method switching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 10 years, 1 month 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/status/input_method_menu.cc
diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc
index 027f1418cc387181ca47f7737b9bbe79589f179c..8260e087e6cb826b2621f73639bf400289f3b200 100644
--- a/chrome/browser/chromeos/status/input_method_menu.cc
+++ b/chrome/browser/chromeos/status/input_method_menu.cc
@@ -378,16 +378,20 @@ void InputMethodMenu::RunMenu(
////////////////////////////////////////////////////////////////////////////////
// InputMethodLibrary::Observer implementation:
-void InputMethodMenu::InputMethodChanged(InputMethodLibrary* obj) {
+void InputMethodMenu::InputMethodChanged(
+ InputMethodLibrary* obj,
+ const InputMethodDescriptor& previous_input_method,
+ const InputMethodDescriptor& current_input_method,
+ size_t num_active_input_methods) {
UserMetrics::RecordAction(
UserMetricsAction("LanguageMenuButton_InputMethodChanged"));
+ UpdateUIFromInputMethod(current_input_method, num_active_input_methods);
+}
- const InputMethodDescriptor& previous_input_method =
- obj->previous_input_method();
- const InputMethodDescriptor& current_input_method =
- obj->current_input_method();
- UpdateUIFromInputMethod(current_input_method);
- // Update Chrome prefs as well.
+void InputMethodMenu::PreferenceUpdateNeeded(
+ InputMethodLibrary* obj,
+ const InputMethodDescriptor& previous_input_method,
+ const InputMethodDescriptor& current_input_method) {
if (is_browser_mode_) {
if (pref_service_) { // make sure we're not in unit tests.
// Sometimes (e.g. initial boot) |previous_input_method.id| is empty.
@@ -418,20 +422,21 @@ void InputMethodMenu::PrepareForMenuOpen() {
}
}
-void InputMethodMenu::ActiveInputMethodsChanged(InputMethodLibrary* obj) {
+void InputMethodMenu::ActiveInputMethodsChanged(
+ InputMethodLibrary* obj,
+ const InputMethodDescriptor& current_input_method,
+ size_t num_active_input_methods) {
// Update the icon if active input methods are changed. See also
- // comments in UpdateUI()
- UpdateUIFromInputMethod(obj->current_input_method());
-}
-
-void InputMethodMenu::ImePropertiesChanged(InputMethodLibrary* obj) {
+ // comments in UpdateUI() in input_method_menu_button.cc.
+ UpdateUIFromInputMethod(current_input_method, num_active_input_methods);
}
void InputMethodMenu::UpdateUIFromInputMethod(
- const InputMethodDescriptor& input_method) {
+ const InputMethodDescriptor& input_method,
+ size_t num_active_input_methods) {
const std::wstring name = GetTextForIndicator(input_method);
const std::wstring tooltip = GetTextForMenu(input_method);
- UpdateUI(name, tooltip);
+ UpdateUI(input_method.id, name, tooltip, num_active_input_methods);
}
void InputMethodMenu::RebuildModel() {
« no previous file with comments | « chrome/browser/chromeos/status/input_method_menu.h ('k') | chrome/browser/chromeos/status/input_method_menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698