| OLD | NEW |
| 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" |
| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // inconsistent states, we check the client's composition state again. | 259 // inconsistent states, we check the client's composition state again. |
| 259 if (GetTextInputClient()->HasCompositionText()) | 260 if (GetTextInputClient()->HasCompositionText()) |
| 260 GetTextInputClient()->ConfirmCompositionText(); | 261 GetTextInputClient()->ConfirmCompositionText(); |
| 261 } | 262 } |
| 262 } | 263 } |
| 263 | 264 |
| 264 void InputMethodIMM32::UpdateIMEState() { | 265 void InputMethodIMM32::UpdateIMEState() { |
| 265 // Use switch here in case we are going to add more text input types. | 266 // Use switch here in case we are going to add more text input types. |
| 266 // We disable input method in password field. | 267 // We disable input method in password field. |
| 267 const HWND window_handle = GetAttachedWindowHandle(GetTextInputClient()); | 268 const HWND window_handle = GetAttachedWindowHandle(GetTextInputClient()); |
| 268 switch (GetTextInputType()) { | 269 const TextInputType text_input_type = GetTextInputType(); |
| 270 const TextInputMode text_input_mode = GetTextInputMode(); |
| 271 switch (text_input_type) { |
| 269 case ui::TEXT_INPUT_TYPE_NONE: | 272 case ui::TEXT_INPUT_TYPE_NONE: |
| 270 case ui::TEXT_INPUT_TYPE_PASSWORD: | 273 case ui::TEXT_INPUT_TYPE_PASSWORD: |
| 271 imm32_manager_.DisableIME(window_handle); | 274 imm32_manager_.DisableIME(window_handle); |
| 272 enabled_ = false; | 275 enabled_ = false; |
| 273 break; | 276 break; |
| 274 default: | 277 default: |
| 275 imm32_manager_.EnableIME(window_handle); | 278 imm32_manager_.EnableIME(window_handle); |
| 276 enabled_ = true; | 279 enabled_ = true; |
| 277 break; | 280 break; |
| 278 } | 281 } |
| 279 | 282 |
| 280 imm32_manager_.SetTextInputMode(window_handle, GetTextInputMode()); | 283 imm32_manager_.SetTextInputMode(window_handle, text_input_mode); |
| 284 tsf_inputscope::SetInputScopeForTsfUnawareWindow( |
| 285 window_handle, text_input_type, text_input_mode); |
| 281 } | 286 } |
| 282 | 287 |
| 283 } // namespace ui | 288 } // namespace ui |
| OLD | NEW |