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

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

Issue 17546002: Support SetFocusedTextInputClient(NULL) in InputMethodTSF (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | 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_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
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 whichever client is attached".
95 TextInputClient* focused_client =
96 ui::TSFBridge::GetInstance()->GetFocusedTextInputClient();
97 ui::TSFBridge::GetInstance()->RemoveFocusedClient(focused_client);
Seigo Nonaka 2013/06/21 12:12:38 can be follows? ui::TSFBridge::GetInstance()->Remo
Yohei Yukawa 2013/06/22 10:46:40 Done.
92 } 98 }
93 InputMethodWin::SetFocusedTextInputClient(client); 99 InputMethodWin::SetFocusedTextInputClient(client);
94 } 100 }
95 101
96 void InputMethodTSF::OnWillChangeFocusedClient(TextInputClient* focused_before, 102 void InputMethodTSF::OnWillChangeFocusedClient(TextInputClient* focused_before,
97 TextInputClient* focused) { 103 TextInputClient* focused) {
98 if (IsWindowFocused(focused_before)) { 104 if (IsWindowFocused(focused_before)) {
99 ConfirmCompositionText(); 105 ConfirmCompositionText();
100 ui::TSFBridge::GetInstance()->RemoveFocusedClient(focused_before); 106 ui::TSFBridge::GetInstance()->RemoveFocusedClient(focused_before);
101 } 107 }
(...skipping 25 matching lines...) Expand all
127 } 133 }
128 134
129 bool InputMethodTSF::IsWindowFocused(const TextInputClient* client) const { 135 bool InputMethodTSF::IsWindowFocused(const TextInputClient* client) const {
130 if (!client) 136 if (!client)
131 return false; 137 return false;
132 HWND attached_window_handle = GetAttachedWindowHandle(client); 138 HWND attached_window_handle = GetAttachedWindowHandle(client);
133 return attached_window_handle && GetFocus() == attached_window_handle; 139 return attached_window_handle && GetFocus() == attached_window_handle;
134 } 140 }
135 141
136 } // namespace ui 142 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698