OLD | NEW |
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" |
11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 | 14 |
15 InputMethodBridge::InputMethodBridge(internal::InputMethodDelegate* delegate, | 15 InputMethodBridge::InputMethodBridge(internal::InputMethodDelegate* delegate, |
16 ui::InputMethod* host, | 16 ui::InputMethod* host, |
17 bool shared_input_method) | 17 bool shared_input_method) |
18 : host_(host), | 18 : host_(host), |
19 shared_input_method_(shared_input_method), | 19 shared_input_method_(shared_input_method) { |
20 context_focused_(false) { | |
21 DCHECK(host_); | 20 DCHECK(host_); |
22 SetDelegate(delegate); | 21 SetDelegate(delegate); |
23 } | 22 } |
24 | 23 |
25 InputMethodBridge::~InputMethodBridge() { | 24 InputMethodBridge::~InputMethodBridge() { |
26 // By the time we get here it's very likely |widget_|'s NativeWidget has been | 25 // 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, | 26 // destroyed. This means any calls to |widget_| that go to the NativeWidget, |
28 // such as IsActive(), will crash. SetFocusedTextInputClient() may callback to | 27 // 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 | 28 // this and go into |widget_|. NULL out |widget_| so we don't attempt to use |
30 // it. | 29 // it. |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 OnTextInputTypeChanged(focused); | 247 OnTextInputTypeChanged(focused); |
249 OnCaretBoundsChanged(focused); | 248 OnCaretBoundsChanged(focused); |
250 } | 249 } |
251 | 250 |
252 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { | 251 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { |
253 return host_; | 252 return host_; |
254 } | 253 } |
255 | 254 |
256 | 255 |
257 } // namespace views | 256 } // namespace views |
OLD | NEW |