| 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 | 10 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // a result text to us, in case the input method and the client are in | 263 // 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. | 264 // inconsistent states, we check the client's composition state again. |
| 265 if (GetTextInputClient()->HasCompositionText()) | 265 if (GetTextInputClient()->HasCompositionText()) |
| 266 GetTextInputClient()->ConfirmCompositionText(); | 266 GetTextInputClient()->ConfirmCompositionText(); |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 void InputMethodIMM32::UpdateIMEState() { | 270 void InputMethodIMM32::UpdateIMEState() { |
| 271 // Use switch here in case we are going to add more text input types. | 271 // Use switch here in case we are going to add more text input types. |
| 272 // We disable input method in password field. | 272 // We disable input method in password field. |
| 273 const HWND window_handle = GetAttachedWindowHandle(GetTextInputClient()); |
| 273 switch (GetTextInputType()) { | 274 switch (GetTextInputType()) { |
| 274 case ui::TEXT_INPUT_TYPE_NONE: | 275 case ui::TEXT_INPUT_TYPE_NONE: |
| 275 case ui::TEXT_INPUT_TYPE_PASSWORD: | 276 case ui::TEXT_INPUT_TYPE_PASSWORD: |
| 276 imm32_manager_.DisableIME(GetAttachedWindowHandle(GetTextInputClient())); | 277 imm32_manager_.DisableIME(window_handle); |
| 277 enabled_ = false; | 278 enabled_ = false; |
| 278 break; | 279 break; |
| 279 default: | 280 default: |
| 280 imm32_manager_.EnableIME(GetAttachedWindowHandle(GetTextInputClient())); | 281 imm32_manager_.EnableIME(window_handle); |
| 281 enabled_ = true; | 282 enabled_ = true; |
| 282 break; | 283 break; |
| 283 } | 284 } |
| 285 |
| 286 imm32_manager_.SetTextInputMode(window_handle, GetTextInputMode()); |
| 284 } | 287 } |
| 285 | 288 |
| 286 bool InputMethodIMM32::IsWindowFocused(const TextInputClient* client) const { | 289 bool InputMethodIMM32::IsWindowFocused(const TextInputClient* client) const { |
| 287 if (!client) | 290 if (!client) |
| 288 return false; | 291 return false; |
| 289 HWND attached_window_handle = GetAttachedWindowHandle(client); | 292 HWND attached_window_handle = GetAttachedWindowHandle(client); |
| 290 return attached_window_handle && GetFocus() == attached_window_handle; | 293 return attached_window_handle && GetFocus() == attached_window_handle; |
| 291 } | 294 } |
| 292 | 295 |
| 293 } // namespace ui | 296 } // namespace ui |
| OLD | NEW |