summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 22:14:35 +0000
committerkerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 22:14:35 +0000
commitfe2534f1d0294dadd3bc915982ef378906a2be57 (patch)
tree685237cedeb93d30d87cf636e5d231971f40c45c
parent4c069962107452fb36c76a3845bb713c0532c606 (diff)
downloadchromium_src-fe2534f1d0294dadd3bc915982ef378906a2be57.zip
chromium_src-fe2534f1d0294dadd3bc915982ef378906a2be57.tar.gz
chromium_src-fe2534f1d0294dadd3bc915982ef378906a2be57.tar.bz2
Merge 82263 - Fix the inconsistency of input-method menu against shift+alt rushBUG=chromium-os:12351TEST=1. open “Languages and Input” dialog2. confirm “Japanese” language is usable3. check on “all Japanese input method”4. click “Language Icon” to display pulldown menu5. press SHIFT+ALT6. confirm selection of “input method” is changed7. press SHIFT+ALT several time very fastand verify the list of input modes (hiragana, katakana, ...) iscorrectly displayed as menu items.Review URL: http://codereview.chromium.org/6882065
TBR=yusukes@google.com Review URL: http://codereview.chromium.org/6873128 git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@82370 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/cros/input_method_library.cc10
-rw-r--r--chrome/browser/chromeos/cros/input_method_library.h5
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.cc23
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.h3
4 files changed, 41 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/cros/input_method_library.cc b/chrome/browser/chromeos/cros/input_method_library.cc
index e174b8f..58c4e37 100644
--- a/chrome/browser/chromeos/cros/input_method_library.cc
+++ b/chrome/browser/chromeos/cros/input_method_library.cc
@@ -613,6 +613,11 @@ class InputMethodLibraryImpl : public InputMethodLibrary,
void RegisterProperties(const ImePropertyList& prop_list) {
// |prop_list| might be empty. This means "clear all properties."
current_ime_properties_ = prop_list;
+
+ // Update input method menu
+ FOR_EACH_OBSERVER(Observer, observers_,
+ PropertyListChanged(this,
+ current_ime_properties_));
}
// Starts the input method daemon. Unlike MaybeStopInputMethodDaemon(),
@@ -628,6 +633,11 @@ class InputMethodLibraryImpl : public InputMethodLibrary,
for (size_t i = 0; i < prop_list.size(); ++i) {
FindAndUpdateProperty(prop_list[i], &current_ime_properties_);
}
+
+ // Update input method menu
+ FOR_EACH_OBSERVER(Observer, observers_,
+ PropertyListChanged(this,
+ current_ime_properties_));
}
// Launches an input method procsess specified by the given command
diff --git a/chrome/browser/chromeos/cros/input_method_library.h b/chrome/browser/chromeos/cros/input_method_library.h
index 3a65a12..e42cbbdc 100644
--- a/chrome/browser/chromeos/cros/input_method_library.h
+++ b/chrome/browser/chromeos/cros/input_method_library.h
@@ -43,6 +43,11 @@ class InputMethodLibrary {
const InputMethodDescriptor& previous_input_method,
const InputMethodDescriptor& current_input_method) = 0;
+ // Called when the list of properties is changed.
+ virtual void PropertyListChanged(
+ InputMethodLibrary* obj,
+ const ImePropertyList& current_ime_properties) = 0;
+
// Called by AddObserver() when the first observer is added.
virtual void FirstObserverIsAdded(InputMethodLibrary* obj) = 0;
};
diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc
index 3307017..9b1b0f9 100644
--- a/chrome/browser/chromeos/status/input_method_menu.cc
+++ b/chrome/browser/chromeos/status/input_method_menu.cc
@@ -400,6 +400,29 @@ void InputMethodMenu::PreferenceUpdateNeeded(
}
}
+void InputMethodMenu::PropertyListChanged(
+ InputMethodLibrary* obj,
+ const ImePropertyList& current_ime_properties) {
+ // Usual order of notifications of input method change is:
+ // 1. RegisterProperties(empty)
+ // 2. RegisterProperties(list-of-new-properties)
+ // 3. GlobalInputMethodChanged
+ // However, due to the asynchronicity, we occasionally (but rarely) face to
+ // 1. RegisterProperties(empty)
+ // 2. GlobalInputMethodChanged
+ // 3. RegisterProperties(list-of-new-properties)
+ // this order. On this unusual case, we must rebuild the menu after the last
+ // RegisterProperties. For the other cases, no rebuild is needed. Actually
+ // it is better to be avoided. Otherwise users can sometimes observe the
+ // awkward clear-then-register behavior.
+ if (!current_ime_properties.empty()) {
+ InputMethodLibrary* library = CrosLibrary::Get()->GetInputMethodLibrary();
+ const InputMethodDescriptor& input_method = library->current_input_method();
+ size_t num_active_input_methods = library->GetNumActiveInputMethods();
+ UpdateUIFromInputMethod(input_method, num_active_input_methods);
+ }
+}
+
void InputMethodMenu::FirstObserverIsAdded(InputMethodLibrary* obj) {
// NOTICE: Since this function might be called from the constructor of this
// class, it's better to avoid calling virtual functions.
diff --git a/chrome/browser/chromeos/status/input_method_menu.h b/chrome/browser/chromeos/status/input_method_menu.h
index e377d61..2aed3e6 100644
--- a/chrome/browser/chromeos/status/input_method_menu.h
+++ b/chrome/browser/chromeos/status/input_method_menu.h
@@ -75,6 +75,9 @@ class InputMethodMenu : public views::ViewMenuDelegate,
InputMethodLibrary* obj,
const InputMethodDescriptor& previous_input_method,
const InputMethodDescriptor& current_input_method);
+ virtual void PropertyListChanged(
+ InputMethodLibrary* obj,
+ const ImePropertyList& current_ime_properties);
virtual void FirstObserverIsAdded(InputMethodLibrary* obj);
// NotificationObserver implementation.