summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-16 15:15:01 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-16 15:15:01 +0000
commit2dde6819e9d1c63abd02d5dcd7677dfdc92ff807 (patch)
tree18e599da90ef128f083e66cf2888c37db80eaa71 /ui
parentd1674cc46eb45a64893012d4f3de28bced1bd1c4 (diff)
downloadchromium_src-2dde6819e9d1c63abd02d5dcd7677dfdc92ff807.zip
chromium_src-2dde6819e9d1c63abd02d5dcd7677dfdc92ff807.tar.gz
chromium_src-2dde6819e9d1c63abd02d5dcd7677dfdc92ff807.tar.bz2
ime: Implement the observer list for FakeInputMethod.
BUG=none Review URL: https://codereview.chromium.org/13845017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194365 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/base/ime/fake_input_method.cc16
-rw-r--r--ui/base/ime/fake_input_method.h3
2 files changed, 16 insertions, 3 deletions
diff --git a/ui/base/ime/fake_input_method.cc b/ui/base/ime/fake_input_method.cc
index 5b330ee..66e2215 100644
--- a/ui/base/ime/fake_input_method.cc
+++ b/ui/base/ime/fake_input_method.cc
@@ -51,6 +51,8 @@ void FakeInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) {
void FakeInputMethod::SetFocusedTextInputClient(TextInputClient* client) {
text_input_client_ = client;
+ FOR_EACH_OBSERVER(InputMethodObserver, observers_,
+ OnTextInputStateChanged(client));
}
TextInputClient* FakeInputMethod::GetTextInputClient() const {
@@ -111,7 +113,10 @@ bool FakeInputMethod::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) {
void FakeInputMethod::Init(bool focused) {}
void FakeInputMethod::OnFocus() {}
void FakeInputMethod::OnBlur() {}
-void FakeInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {}
+void FakeInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {
+ FOR_EACH_OBSERVER(InputMethodObserver, observers_,
+ OnTextInputStateChanged(client));
+}
void FakeInputMethod::OnCaretBoundsChanged(const TextInputClient* client) {}
void FakeInputMethod::CancelComposition(const TextInputClient* client) {}
@@ -135,7 +140,12 @@ bool FakeInputMethod::CanComposeInline() const {
return true;
}
-void FakeInputMethod::AddObserver(InputMethodObserver* observer) {}
-void FakeInputMethod::RemoveObserver(InputMethodObserver* observer) {}
+void FakeInputMethod::AddObserver(InputMethodObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void FakeInputMethod::RemoveObserver(InputMethodObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
} // namespace ui
diff --git a/ui/base/ime/fake_input_method.h b/ui/base/ime/fake_input_method.h
index eef05a6..7e71c42 100644
--- a/ui/base/ime/fake_input_method.h
+++ b/ui/base/ime/fake_input_method.h
@@ -9,7 +9,9 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/observer_list.h"
#include "ui/base/ime/input_method.h"
+#include "ui/base/ime/input_method_observer.h"
#include "ui/base/ui_export.h"
namespace ui {
@@ -47,6 +49,7 @@ class UI_EXPORT FakeInputMethod : NON_EXPORTED_BASE(public InputMethod) {
private:
internal::InputMethodDelegate* delegate_;
TextInputClient* text_input_client_;
+ ObserverList<InputMethodObserver> observers_;
DISALLOW_COPY_AND_ASSIGN(FakeInputMethod);
};