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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 DetachFromWidget(); | 31 DetachFromWidget(); |
32 if (host_->GetTextInputClient() == this) | 32 if (host_->GetTextInputClient() == this) |
33 host_->SetFocusedTextInputClient(NULL); | 33 host_->SetFocusedTextInputClient(NULL); |
34 } | 34 } |
35 | 35 |
36 void InputMethodBridge::OnFocus() { | 36 void InputMethodBridge::OnFocus() { |
37 // Direct the shared IME to send TextInputClient messages to |this| object. | 37 // Direct the shared IME to send TextInputClient messages to |this| object. |
38 if (shared_input_method_ || !host_->GetTextInputClient()) | 38 if (shared_input_method_ || !host_->GetTextInputClient()) |
39 host_->SetFocusedTextInputClient(this); | 39 host_->SetFocusedTextInputClient(this); |
40 | 40 |
| 41 OnPossibleRefocus(); |
| 42 } |
| 43 |
| 44 void InputMethodBridge::OnPossibleRefocus() { |
41 // TODO(yusukes): We don't need to call OnTextInputTypeChanged() once we move | 45 // TODO(yusukes): We don't need to call OnTextInputTypeChanged() once we move |
42 // text input type tracker code to ui::InputMethodBase. | 46 // text input type tracker code to ui::InputMethodBase. |
43 if (GetFocusedView()) | 47 if (GetFocusedView()) |
44 OnTextInputTypeChanged(GetFocusedView()); | 48 OnTextInputTypeChanged(GetFocusedView()); |
45 } | 49 } |
46 | 50 |
47 void InputMethodBridge::OnBlur() { | 51 void InputMethodBridge::OnBlur() { |
48 ConfirmCompositionText(); | 52 ConfirmCompositionText(); |
49 | 53 |
50 if (host_->GetTextInputClient() == this) | 54 if (host_->GetTextInputClient() == this) |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 OnTextInputTypeChanged(focused); | 245 OnTextInputTypeChanged(focused); |
242 OnCaretBoundsChanged(focused); | 246 OnCaretBoundsChanged(focused); |
243 } | 247 } |
244 | 248 |
245 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { | 249 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { |
246 return host_; | 250 return host_; |
247 } | 251 } |
248 | 252 |
249 | 253 |
250 } // namespace views | 254 } // namespace views |
OLD | NEW |