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

Side by Side Diff: ui/base/ime/fake_input_method.cc

Issue 13845017: ime: Implement the observer list for FakeInputMethod. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/ime/fake_input_method.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/ime/fake_input_method.h" 5 #include "ui/base/ime/fake_input_method.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "ui/base/events/event.h" 9 #include "ui/base/events/event.h"
10 #include "ui/base/events/event_constants.h" 10 #include "ui/base/events/event_constants.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 FakeInputMethod::~FakeInputMethod() { 45 FakeInputMethod::~FakeInputMethod() {
46 } 46 }
47 47
48 void FakeInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) { 48 void FakeInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) {
49 delegate_ = delegate; 49 delegate_ = delegate;
50 } 50 }
51 51
52 void FakeInputMethod::SetFocusedTextInputClient(TextInputClient* client) { 52 void FakeInputMethod::SetFocusedTextInputClient(TextInputClient* client) {
53 text_input_client_ = client; 53 text_input_client_ = client;
54 FOR_EACH_OBSERVER(InputMethodObserver, observers_,
55 OnTextInputStateChanged(client));
54 } 56 }
55 57
56 TextInputClient* FakeInputMethod::GetTextInputClient() const { 58 TextInputClient* FakeInputMethod::GetTextInputClient() const {
57 return text_input_client_; 59 return text_input_client_;
58 } 60 }
59 61
60 bool FakeInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) { 62 bool FakeInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) {
61 bool handled = false; 63 bool handled = false;
62 #if defined(OS_WIN) 64 #if defined(OS_WIN)
63 if (native_event.message == WM_CHAR) { 65 if (native_event.message == WM_CHAR) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 event.type(), event.key_code(), event.flags()); 104 event.type(), event.key_code(), event.flags());
103 if (event.type() == ET_KEY_PRESSED && text_input_client_) { 105 if (event.type() == ET_KEY_PRESSED && text_input_client_) {
104 uint16 ch = event.GetCharacter(); 106 uint16 ch = event.GetCharacter();
105 if (ch) 107 if (ch)
106 text_input_client_->InsertChar(ch, event.flags()); 108 text_input_client_->InsertChar(ch, event.flags());
107 } 109 }
108 return handled; 110 return handled;
109 } 111 }
110 112
111 void FakeInputMethod::Init(bool focused) {} 113 void FakeInputMethod::Init(bool focused) {}
112 void FakeInputMethod::OnFocus() {} 114 void FakeInputMethod::OnFocus() {}
sadrul 2013/04/16 02:25:18 Is it necessary to trigger the observer callback f
Seigo Nonaka 2013/04/16 07:49:18 I think no as far as virtual keyboard is not the c
sadrul 2013/04/16 15:14:56 Ah, cool. Thanks!
113 void FakeInputMethod::OnBlur() {} 115 void FakeInputMethod::OnBlur() {}
114 void FakeInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {} 116 void FakeInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {
117 FOR_EACH_OBSERVER(InputMethodObserver, observers_,
118 OnTextInputStateChanged(client));
119 }
115 void FakeInputMethod::OnCaretBoundsChanged(const TextInputClient* client) {} 120 void FakeInputMethod::OnCaretBoundsChanged(const TextInputClient* client) {}
116 void FakeInputMethod::CancelComposition(const TextInputClient* client) {} 121 void FakeInputMethod::CancelComposition(const TextInputClient* client) {}
117 122
118 std::string FakeInputMethod::GetInputLocale() { 123 std::string FakeInputMethod::GetInputLocale() {
119 return ""; 124 return "";
120 } 125 }
121 126
122 base::i18n::TextDirection FakeInputMethod::GetInputTextDirection() { 127 base::i18n::TextDirection FakeInputMethod::GetInputTextDirection() {
123 return base::i18n::UNKNOWN_DIRECTION; 128 return base::i18n::UNKNOWN_DIRECTION;
124 } 129 }
125 130
126 bool FakeInputMethod::IsActive() { 131 bool FakeInputMethod::IsActive() {
127 return true; 132 return true;
128 } 133 }
129 134
130 ui::TextInputType FakeInputMethod::GetTextInputType() const { 135 ui::TextInputType FakeInputMethod::GetTextInputType() const {
131 return ui::TEXT_INPUT_TYPE_NONE; 136 return ui::TEXT_INPUT_TYPE_NONE;
132 } 137 }
133 138
134 bool FakeInputMethod::CanComposeInline() const { 139 bool FakeInputMethod::CanComposeInline() const {
135 return true; 140 return true;
136 } 141 }
137 142
138 void FakeInputMethod::AddObserver(InputMethodObserver* observer) {} 143 void FakeInputMethod::AddObserver(InputMethodObserver* observer) {
139 void FakeInputMethod::RemoveObserver(InputMethodObserver* observer) {} 144 observers_.AddObserver(observer);
145 }
146
147 void FakeInputMethod::RemoveObserver(InputMethodObserver* observer) {
148 observers_.RemoveObserver(observer);
149 }
140 150
141 } // namespace ui 151 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/fake_input_method.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698