Chromium Code Reviews| Index: chrome/browser/chromeos/cros/input_method_library.cc |
| diff --git a/chrome/browser/chromeos/cros/input_method_library.cc b/chrome/browser/chromeos/cros/input_method_library.cc |
| index 1e6f15af8a6b8813b0ea215ca0bff6f94ff7a4cc..2c53f463dcdbd969af96660020fa25d1d100e394 100644 |
| --- a/chrome/browser/chromeos/cros/input_method_library.cc |
| +++ b/chrome/browser/chromeos/cros/input_method_library.cc |
| @@ -22,7 +22,17 @@ |
| #include "chrome/common/notification_registrar.h" |
| #include "chrome/common/notification_service.h" |
| +#define NOTIFY_FIRST_OBSERVER(ObserverType, observer_list, func) \ |
|
satorux1
2010/12/01 06:40:18
The macro seems to be only used once. Probably not
Yusuke Sato
2010/12/01 07:36:41
Done.
|
| + do { \ |
| + ObserverListBase<ObserverType>::Iterator it(observer_list); \ |
| + ObserverType* first_observer; \ |
| + if ((first_observer = it.GetNext()) != NULL) { \ |
| + first_observer->func; \ |
| + } \ |
| + } while (0) |
| + |
| namespace { |
| + |
| const char kIBusDaemonPath[] = "/usr/bin/ibus-daemon"; |
| const char kCandidateWindowPath[] = "/opt/google/chrome/candidate_window"; |
| @@ -290,7 +300,11 @@ class InputMethodLibraryImpl : public InputMethodLibrary, |
| } |
| if (active_input_methods_are_changed) { |
| - FOR_EACH_OBSERVER(Observer, observers_, ActiveInputMethodsChanged(this)); |
| + const size_t num_active_input_methods = GetNumActiveInputMethods(); |
| + FOR_EACH_OBSERVER(Observer, observers_, |
| + ActiveInputMethodsChanged(this, |
| + current_input_method_, |
| + num_active_input_methods)); |
| } |
| } |
| @@ -386,13 +400,21 @@ class InputMethodLibraryImpl : public InputMethodLibrary, |
| previous_input_method_ = current_input_method_; |
| current_input_method_ = new_input_method; |
| } |
| - FOR_EACH_OBSERVER(Observer, observers_, InputMethodChanged(this)); |
| + const size_t num_active_input_methods = GetNumActiveInputMethods(); |
| + FOR_EACH_OBSERVER(Observer, observers_, |
| + InputMethodChanged(this, |
| + previous_input_method_, |
| + current_input_method_, |
| + num_active_input_methods)); |
| + NOTIFY_FIRST_OBSERVER(Observer, observers_, |
|
satorux1
2010/12/01 06:40:18
Please add a comment about why you notify this to
Yusuke Sato
2010/12/01 07:36:41
Done.
|
| + PreferenceUpdateNeeded(this, |
| + previous_input_method_, |
| + current_input_method_)); |
| } |
| void RegisterProperties(const ImePropertyList& prop_list) { |
| // |prop_list| might be empty. This means "clear all properties." |
| current_ime_properties_ = prop_list; |
| - FOR_EACH_OBSERVER(Observer, observers_, ImePropertiesChanged(this)); |
| } |
| void StartInputMethodProcesses() { |
| @@ -404,7 +426,6 @@ class InputMethodLibraryImpl : public InputMethodLibrary, |
| for (size_t i = 0; i < prop_list.size(); ++i) { |
| FindAndUpdateProperty(prop_list[i], ¤t_ime_properties_); |
| } |
| - FOR_EACH_OBSERVER(Observer, observers_, ImePropertiesChanged(this)); |
| } |
| // Launches an input method procsess specified by the given command |