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

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

Issue 1257603006: Refactoring for the InputMethod & InputMethodDelegate interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Sadrul's comment. Created 5 years, 4 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
« no previous file with comments | « ui/base/ime/mock_input_method.cc ('k') | ui/base/ime/remote_input_method_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/remote_input_method_win.h" 5 #include "ui/base/ime/remote_input_method_win.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/win/metro.h" 10 #include "base/win/metro.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void DetachTextInputClient(TextInputClient* client) override { 172 void DetachTextInputClient(TextInputClient* client) override {
173 if (text_input_client_ != client) 173 if (text_input_client_ != client)
174 return; 174 return;
175 SetFocusedTextInputClient(NULL); 175 SetFocusedTextInputClient(NULL);
176 } 176 }
177 177
178 TextInputClient* GetTextInputClient() const override { 178 TextInputClient* GetTextInputClient() const override {
179 return text_input_client_; 179 return text_input_client_;
180 } 180 }
181 181
182 bool DispatchKeyEvent(const ui::KeyEvent& event) override { 182 void DispatchKeyEvent(ui::KeyEvent* event) override {
183 if (event.HasNativeEvent()) { 183 if (event->HasNativeEvent()) {
184 const base::NativeEvent& native_key_event = event.native_event(); 184 const base::NativeEvent& native_key_event = event->native_event();
185 if (native_key_event.message != WM_CHAR) 185 if (native_key_event.message == WM_CHAR && text_input_client_) {
186 return false; 186 text_input_client_->InsertChar(
187 if (!text_input_client_) 187 static_cast<base::char16>(native_key_event.wParam),
188 return false; 188 ui::GetModifiersFromKeyState());
189 text_input_client_->InsertChar( 189 event->StopPropagation();
190 static_cast<base::char16>(native_key_event.wParam), 190 }
191 ui::GetModifiersFromKeyState()); 191 return;
192 return true;
193 } 192 }
194 193
195 if (event.is_char()) { 194 if (event->is_char()) {
196 if (text_input_client_) { 195 if (text_input_client_) {
197 text_input_client_->InsertChar( 196 text_input_client_->InsertChar(
198 event.GetCharacter(), 197 event->GetCharacter(),
199 ui::GetModifiersFromKeyState()); 198 ui::GetModifiersFromKeyState());
200 } 199 }
201 return true; 200 event->StopPropagation();
201 return;
202 } 202 }
203 if (!delegate_) 203 if (delegate_)
204 return false; 204 ignore_result(delegate_->DispatchKeyEventPostIME(event));
205 return delegate_->DispatchKeyEventPostIME(event);
206 } 205 }
207 206
208 void OnTextInputTypeChanged(const TextInputClient* client) override { 207 void OnTextInputTypeChanged(const TextInputClient* client) override {
209 if (!text_input_client_ || text_input_client_ != client) 208 if (!text_input_client_ || text_input_client_ != client)
210 return; 209 return;
211 std::vector<int32> prev_input_scopes; 210 std::vector<int32> prev_input_scopes;
212 std::swap(input_scopes_, prev_input_scopes); 211 std::swap(input_scopes_, prev_input_scopes);
213 input_scopes_ = GetInputScopesAsInt(client->GetTextInputType(), 212 input_scopes_ = GetInputScopesAsInt(client->GetTextInputType(),
214 client->GetTextInputMode()); 213 client->GetTextInputMode());
215 if (input_scopes_ != prev_input_scopes && remote_delegate_) { 214 if (input_scopes_ != prev_input_scopes && remote_delegate_) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 return make_scoped_ptr(new RemoteInputMethodWin(delegate)); 374 return make_scoped_ptr(new RemoteInputMethodWin(delegate));
376 } 375 }
377 376
378 // static 377 // static
379 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get( 378 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get(
380 InputMethod* input_method) { 379 InputMethod* input_method) {
381 return GetPrivate(input_method); 380 return GetPrivate(input_method);
382 } 381 }
383 382
384 } // namespace ui 383 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/mock_input_method.cc ('k') | ui/base/ime/remote_input_method_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698