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

Side by Side Diff: ui/views/ime/input_method_bridge.cc

Issue 23615013: Completes crrev.com/23478020 and makes sure of detachment from IME. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « ui/base/ime/win/tsf_bridge.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/ime/input_method_bridge.h" 5 #include "ui/views/ime/input_method_bridge.h"
6 6
7 #include "ui/base/events/event.h" 7 #include "ui/base/events/event.h"
8 #include "ui/base/ime/input_method.h" 8 #include "ui/base/ime/input_method.h"
9 #include "ui/gfx/rect.h" 9 #include "ui/gfx/rect.h"
10 #include "ui/views/view.h" 10 #include "ui/views/view.h"
(...skipping 11 matching lines...) Expand all
22 SetDelegate(delegate); 22 SetDelegate(delegate);
23 } 23 }
24 24
25 InputMethodBridge::~InputMethodBridge() { 25 InputMethodBridge::~InputMethodBridge() {
26 // By the time we get here it's very likely |widget_|'s NativeWidget has been 26 // By the time we get here it's very likely |widget_|'s NativeWidget has been
27 // destroyed. This means any calls to |widget_| that go to the NativeWidget, 27 // destroyed. This means any calls to |widget_| that go to the NativeWidget,
28 // such as IsActive(), will crash. SetFocusedTextInputClient() may callback to 28 // such as IsActive(), will crash. SetFocusedTextInputClient() may callback to
29 // this and go into |widget_|. NULL out |widget_| so we don't attempt to use 29 // this and go into |widget_|. NULL out |widget_| so we don't attempt to use
30 // it. 30 // it.
31 DetachFromWidget(); 31 DetachFromWidget();
32 if (host_->GetTextInputClient() == this) 32 host_->DetachTextInputClient(this);
33 host_->SetFocusedTextInputClient(NULL);
34 } 33 }
35 34
36 void InputMethodBridge::OnFocus() { 35 void InputMethodBridge::OnFocus() {
37 // Direct the shared IME to send TextInputClient messages to |this| object. 36 // Direct the shared IME to send TextInputClient messages to |this| object.
38 if (shared_input_method_ || !host_->GetTextInputClient()) 37 if (shared_input_method_ || !host_->GetTextInputClient())
39 host_->SetFocusedTextInputClient(this); 38 host_->SetFocusedTextInputClient(this);
40 39
41 // TODO(yusukes): We don't need to call OnTextInputTypeChanged() once we move 40 // TODO(yusukes): We don't need to call OnTextInputTypeChanged() once we move
42 // text input type tracker code to ui::InputMethodBase. 41 // text input type tracker code to ui::InputMethodBase.
43 if (GetFocusedView()) 42 if (GetFocusedView())
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 OnTextInputTypeChanged(focused); 248 OnTextInputTypeChanged(focused);
250 OnCaretBoundsChanged(focused); 249 OnCaretBoundsChanged(focused);
251 } 250 }
252 251
253 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { 252 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const {
254 return host_; 253 return host_;
255 } 254 }
256 255
257 256
258 } // namespace views 257 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/ime/win/tsf_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698