OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |