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 27 matching lines...) Expand all Loading... |
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 // TODO(yusukes): We don't need to call OnTextInputTypeChanged() once we move | 41 // TODO(yusukes): We don't need to call OnTextInputTypeChanged() once we move |
42 // text input type tracker code to ui::InputMethodBase. | 42 // text input type tracker code to ui::InputMethodBase. |
43 if (GetFocusedView()) | 43 if (GetFocusedView()) |
44 OnTextInputTypeChanged(GetFocusedView()); | 44 OnTextInputTypeChanged(GetFocusedView()); |
45 } | 45 } |
46 | 46 |
47 void InputMethodBridge::OnBlur() { | 47 void InputMethodBridge::OnBlur() { |
48 ConfirmCompositionText(); | 48 if (HasCompositionText()) { |
| 49 ConfirmCompositionText(); |
| 50 host_->CancelComposition(this); |
| 51 } |
49 | 52 |
50 if (host_->GetTextInputClient() == this) | 53 if (host_->GetTextInputClient() == this) |
51 host_->SetFocusedTextInputClient(NULL); | 54 host_->SetFocusedTextInputClient(NULL); |
52 } | 55 } |
53 | 56 |
54 bool InputMethodBridge::OnUntranslatedIMEMessage(const base::NativeEvent& event, | 57 bool InputMethodBridge::OnUntranslatedIMEMessage(const base::NativeEvent& event, |
55 NativeEventResult* result) { | 58 NativeEventResult* result) { |
56 return host_->OnUntranslatedIMEMessage(event, result); | 59 return host_->OnUntranslatedIMEMessage(event, result); |
57 } | 60 } |
58 | 61 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 OnTextInputTypeChanged(focused); | 244 OnTextInputTypeChanged(focused); |
242 OnCaretBoundsChanged(focused); | 245 OnCaretBoundsChanged(focused); |
243 } | 246 } |
244 | 247 |
245 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { | 248 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { |
246 return host_; | 249 return host_; |
247 } | 250 } |
248 | 251 |
249 | 252 |
250 } // namespace views | 253 } // namespace views |
OLD | NEW |