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

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

Issue 23445020: Support inputmode attribute for Windows Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « content/browser/renderer_host/render_widget_host_view_aura.cc ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/input_method_imm32.h" 5 #include "ui/base/ime/input_method_imm32.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "ui/base/ime/composition_text.h" 8 #include "ui/base/ime/composition_text.h"
9 #include "ui/base/ime/text_input_client.h" 9 #include "ui/base/ime/text_input_client.h"
10 #include "ui/base/ime/win/tsf_input_scope.h"
Yohei Yukawa 2013/09/02 04:20:07 Do we really need this header?
yoichio 2013/09/02 04:56:59 Thanks.
10 11
11 12
12 namespace ui { 13 namespace ui {
13 14
14 InputMethodIMM32::InputMethodIMM32(internal::InputMethodDelegate* delegate, 15 InputMethodIMM32::InputMethodIMM32(internal::InputMethodDelegate* delegate,
15 HWND toplevel_window_handle) 16 HWND toplevel_window_handle)
16 : InputMethodWin(delegate, toplevel_window_handle), 17 : InputMethodWin(delegate, toplevel_window_handle),
17 enabled_(false), is_candidate_popup_open_(false), 18 enabled_(false), is_candidate_popup_open_(false),
18 composing_window_handle_(NULL) { 19 composing_window_handle_(NULL) {
19 // In non-Aura environment, appropriate callbacks to OnFocus() and OnBlur() 20 // In non-Aura environment, appropriate callbacks to OnFocus() and OnBlur()
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // a result text to us, in case the input method and the client are in 264 // a result text to us, in case the input method and the client are in
264 // inconsistent states, we check the client's composition state again. 265 // inconsistent states, we check the client's composition state again.
265 if (GetTextInputClient()->HasCompositionText()) 266 if (GetTextInputClient()->HasCompositionText())
266 GetTextInputClient()->ConfirmCompositionText(); 267 GetTextInputClient()->ConfirmCompositionText();
267 } 268 }
268 } 269 }
269 270
270 void InputMethodIMM32::UpdateIMEState() { 271 void InputMethodIMM32::UpdateIMEState() {
271 // Use switch here in case we are going to add more text input types. 272 // Use switch here in case we are going to add more text input types.
272 // We disable input method in password field. 273 // We disable input method in password field.
274 const HWND window_handle = GetAttachedWindowHandle(GetTextInputClient());
273 switch (GetTextInputType()) { 275 switch (GetTextInputType()) {
274 case ui::TEXT_INPUT_TYPE_NONE: 276 case ui::TEXT_INPUT_TYPE_NONE:
275 case ui::TEXT_INPUT_TYPE_PASSWORD: 277 case ui::TEXT_INPUT_TYPE_PASSWORD:
276 imm32_manager_.DisableIME(GetAttachedWindowHandle(GetTextInputClient())); 278 imm32_manager_.DisableIME(window_handle);
277 enabled_ = false; 279 enabled_ = false;
278 break; 280 break;
279 default: 281 default:
280 imm32_manager_.EnableIME(GetAttachedWindowHandle(GetTextInputClient())); 282 imm32_manager_.EnableIME(window_handle);
281 enabled_ = true; 283 enabled_ = true;
282 break; 284 break;
283 } 285 }
286
287 imm32_manager_.SetTextInputMode(window_handle, GetTextInputMode());
284 } 288 }
285 289
286 bool InputMethodIMM32::IsWindowFocused(const TextInputClient* client) const { 290 bool InputMethodIMM32::IsWindowFocused(const TextInputClient* client) const {
287 if (!client) 291 if (!client)
288 return false; 292 return false;
289 HWND attached_window_handle = GetAttachedWindowHandle(client); 293 HWND attached_window_handle = GetAttachedWindowHandle(client);
290 return attached_window_handle && GetFocus() == attached_window_handle; 294 return attached_window_handle && GetFocus() == attached_window_handle;
291 } 295 }
292 296
293 } // namespace ui 297 } // namespace ui
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698