| 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_tsf.h" | 5 #include "ui/base/ime/input_method_tsf.h" |
| 6 | 6 |
| 7 #include "ui/base/ime/text_input_client.h" | 7 #include "ui/base/ime/text_input_client.h" |
| 8 #include "ui/base/ime/win/tsf_bridge.h" | 8 #include "ui/base/ime/win/tsf_bridge.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 void InputMethodTSF::CancelComposition(const TextInputClient* client) { | 83 void InputMethodTSF::CancelComposition(const TextInputClient* client) { |
| 84 if (IsTextInputClientFocused(client) && IsWindowFocused(client)) | 84 if (IsTextInputClientFocused(client) && IsWindowFocused(client)) |
| 85 ui::TSFBridge::GetInstance()->CancelComposition(); | 85 ui::TSFBridge::GetInstance()->CancelComposition(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void InputMethodTSF::SetFocusedTextInputClient(TextInputClient* client) { | 88 void InputMethodTSF::SetFocusedTextInputClient(TextInputClient* client) { |
| 89 if (IsWindowFocused(client)) { | 89 if (IsWindowFocused(client)) { |
| 90 ui::TSFBridge::GetInstance()->SetFocusedClient( | 90 ui::TSFBridge::GetInstance()->SetFocusedClient( |
| 91 GetAttachedWindowHandle(client), client); | 91 GetAttachedWindowHandle(client), client); |
| 92 } else if (!client) { |
| 93 // SetFocusedTextInputClient(NULL) must be interpreted as |
| 94 // "Remove the attached client". |
| 95 ui::TSFBridge::GetInstance()->RemoveFocusedClient( |
| 96 ui::TSFBridge::GetInstance()->GetFocusedTextInputClient()); |
| 92 } | 97 } |
| 93 InputMethodWin::SetFocusedTextInputClient(client); | 98 InputMethodWin::SetFocusedTextInputClient(client); |
| 94 } | 99 } |
| 95 | 100 |
| 96 bool InputMethodTSF::IsCandidatePopupOpen() const { | 101 bool InputMethodTSF::IsCandidatePopupOpen() const { |
| 97 // TODO(yukishiino): Implement this method. | 102 // TODO(yukishiino): Implement this method. |
| 98 return false; | 103 return false; |
| 99 } | 104 } |
| 100 | 105 |
| 101 void InputMethodTSF::OnWillChangeFocusedClient(TextInputClient* focused_before, | 106 void InputMethodTSF::OnWillChangeFocusedClient(TextInputClient* focused_before, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 132 } | 137 } |
| 133 | 138 |
| 134 bool InputMethodTSF::IsWindowFocused(const TextInputClient* client) const { | 139 bool InputMethodTSF::IsWindowFocused(const TextInputClient* client) const { |
| 135 if (!client) | 140 if (!client) |
| 136 return false; | 141 return false; |
| 137 HWND attached_window_handle = GetAttachedWindowHandle(client); | 142 HWND attached_window_handle = GetAttachedWindowHandle(client); |
| 138 return attached_window_handle && GetFocus() == attached_window_handle; | 143 return attached_window_handle && GetFocus() == attached_window_handle; |
| 139 } | 144 } |
| 140 | 145 |
| 141 } // namespace ui | 146 } // namespace ui |
| OLD | NEW |