| 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/base/ime/input_method_base.h" | 5 #include "ui/base/ime/input_method_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 if (ui::IMEBridge::Get() && | 27 if (ui::IMEBridge::Get() && |
| 28 ui::IMEBridge::Get()->GetInputContextHandler() == this) | 28 ui::IMEBridge::Get()->GetInputContextHandler() == this) |
| 29 ui::IMEBridge::Get()->SetInputContextHandler(nullptr); | 29 ui::IMEBridge::Get()->SetInputContextHandler(nullptr); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) { | 32 void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) { |
| 33 delegate_ = delegate; | 33 delegate_ = delegate; |
| 34 } | 34 } |
| 35 | 35 |
| 36 void InputMethodBase::OnFocus() { | 36 void InputMethodBase::OnFocus() { |
| 37 if (ui::IMEBridge::Get()) | 37 if (ui::IMEBridge::Get()) { |
| 38 ui::IMEBridge::Get()->SetInputContextHandler(this); | 38 ui::IMEBridge::Get()->SetInputContextHandler(this); |
| 39 ui::IMEEngineHandlerInterface* engine = |
| 40 ui::IMEBridge::Get()->GetCurrentEngineHandler(); |
| 41 if (engine) |
| 42 engine->MaybeSwitchEngine(); |
| 43 } |
| 39 } | 44 } |
| 40 | 45 |
| 41 void InputMethodBase::OnBlur() { | 46 void InputMethodBase::OnBlur() { |
| 42 if (ui::IMEBridge::Get() && | 47 if (ui::IMEBridge::Get() && |
| 43 ui::IMEBridge::Get()->GetInputContextHandler() == this) | 48 ui::IMEBridge::Get()->GetInputContextHandler() == this) |
| 44 ui::IMEBridge::Get()->SetInputContextHandler(nullptr); | 49 ui::IMEBridge::Get()->SetInputContextHandler(nullptr); |
| 45 } | 50 } |
| 46 | 51 |
| 47 void InputMethodBase::SetFocusedTextInputClient(TextInputClient* client) { | 52 void InputMethodBase::SetFocusedTextInputClient(TextInputClient* client) { |
| 48 SetFocusedTextInputClientInternal(client); | 53 SetFocusedTextInputClientInternal(client); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 InputMethod* InputMethodBase::GetInputMethod() { | 221 InputMethod* InputMethodBase::GetInputMethod() { |
| 217 return this; | 222 return this; |
| 218 } | 223 } |
| 219 | 224 |
| 220 const std::vector<std::unique_ptr<ui::KeyEvent>>& | 225 const std::vector<std::unique_ptr<ui::KeyEvent>>& |
| 221 InputMethodBase::GetKeyEventsForTesting() { | 226 InputMethodBase::GetKeyEventsForTesting() { |
| 222 return key_events_for_testing_; | 227 return key_events_for_testing_; |
| 223 } | 228 } |
| 224 | 229 |
| 225 } // namespace ui | 230 } // namespace ui |
| OLD | NEW |