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

Unified Diff: chrome/browser/chromeos/input_method/input_method_manager.cc

Issue 8840002: (Chrome OS) Notify when the candidate window is opened/closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unused header Created 9 years 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
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/input_method/input_method_manager.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_manager.cc b/chrome/browser/chromeos/input_method/input_method_manager.cc
index 2eb655af231ea470cb0770102378fa0ca7a543a0..3729be5164320120186449205f7b91f9e3a5dead 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager.cc
@@ -129,10 +129,14 @@ namespace chromeos {
namespace input_method {
// The implementation of InputMethodManager.
-class InputMethodManagerImpl : public HotkeyManager::Observer,
- public InputMethodManager,
- public content::NotificationObserver,
- public IBusController::Observer {
+class InputMethodManagerImpl
+ : public HotkeyManager::Observer,
+ public InputMethodManager,
+ public content::NotificationObserver,
+#if !defined(USE_VIRTUAL_KEYBOARD)
+ public CandidateWindowController::Observer,
+#endif
+ public IBusController::Observer {
public:
InputMethodManagerImpl()
: ibus_controller_(IBusController::Create()),
@@ -178,6 +182,10 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
virtual ~InputMethodManagerImpl() {
hotkey_manager_.RemoveObserver(this);
ibus_controller_->RemoveObserver(this);
+#if !defined(USE_VIRTUAL_KEYBOARD)
+ if (candidate_window_controller_.get())
+ candidate_window_controller_->RemoveObserver(this);
+#endif
}
virtual void AddObserver(InputMethodManager::Observer* observer) {
@@ -188,6 +196,16 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
observers_.RemoveObserver(observer);
}
+ virtual void AddCandidateWindowObserver(
+ InputMethodManager::CandidateWindowObserver* observer) {
+ candidate_window_observers_.AddObserver(observer);
+ }
+
+ virtual void RemoveCandidateWindowObserver(
+ InputMethodManager::CandidateWindowObserver* observer) {
+ candidate_window_observers_.RemoveObserver(observer);
+ }
+
virtual void AddPreLoginPreferenceObserver(
InputMethodManager::PreferenceObserver* observer) {
if (!pre_login_preference_observers_.size()) {
@@ -529,6 +547,18 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
}
}
+ virtual void CandidateWindowOpened() {
+ FOR_EACH_OBSERVER(InputMethodManager::CandidateWindowObserver,
+ candidate_window_observers_,
+ CandidateWindowOpened(this));
+ }
+
+ virtual void CandidateWindowClosed() {
+ FOR_EACH_OBSERVER(InputMethodManager::CandidateWindowObserver,
+ candidate_window_observers_,
+ CandidateWindowClosed(this));
+ }
+
virtual void SwitchToNextInputMethod() {
// Sanity checks.
if (active_input_method_ids_.empty()) {
@@ -1105,7 +1135,9 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
#if !defined(USE_VIRTUAL_KEYBOARD)
if (!candidate_window_controller_.get()) {
candidate_window_controller_.reset(new CandidateWindowController);
- if (!candidate_window_controller_->Init()) {
+ if (candidate_window_controller_->Init()) {
+ candidate_window_controller_->AddObserver(this);
+ } else {
LOG(WARNING) << "Failed to initialize the candidate window controller";
}
}
@@ -1181,6 +1213,8 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
notification_registrar_.RemoveAll();
StopInputMethodDaemon();
#if !defined(USE_VIRTUAL_KEYBOARD)
+ if (candidate_window_controller_.get())
+ candidate_window_controller_->RemoveObserver(this);
candidate_window_controller_.reset(NULL);
#endif
}
@@ -1301,6 +1335,8 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
// allow allow callbacks when the input method status changes.
scoped_ptr<IBusController> ibus_controller_;
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_;
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698