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

Unified Diff: ui/base/ime/input_method_base.cc

Issue 1778693004: Set the current input context handler when the toplevel window is activated instead of when the inp… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/input_method_base.cc
diff --git a/ui/base/ime/input_method_base.cc b/ui/base/ime/input_method_base.cc
index 5d53a1943dcf1ff8bb907d7d585e33dfa451b63b..e4af2e847995cdde30ed6120aaecff569a8052bb 100644
--- a/ui/base/ime/input_method_base.cc
+++ b/ui/base/ime/input_method_base.cc
@@ -17,7 +17,7 @@
namespace ui {
InputMethodBase::InputMethodBase()
- : delegate_(NULL), text_input_client_(NULL) {}
+ : delegate_(nullptr), text_input_client_(nullptr) {}
InputMethodBase::~InputMethodBase() {
FOR_EACH_OBSERVER(InputMethodObserver,
@@ -32,20 +32,25 @@ void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) {
delegate_ = delegate;
}
-void InputMethodBase::OnFocus() {}
+void InputMethodBase::OnFocus() {
+ if (ui::IMEBridge::Get())
+ ui::IMEBridge::Get()->SetInputContextHandler(this);
+}
-void InputMethodBase::OnBlur() {}
+void InputMethodBase::OnBlur() {
+ if (ui::IMEBridge::Get() &&
+ ui::IMEBridge::Get()->GetInputContextHandler() == this)
+ ui::IMEBridge::Get()->SetInputContextHandler(nullptr);
+}
void InputMethodBase::SetFocusedTextInputClient(TextInputClient* client) {
SetFocusedTextInputClientInternal(client);
- if (ui::IMEBridge::Get())
- ui::IMEBridge::Get()->SetInputContextHandler(this);
}
void InputMethodBase::DetachTextInputClient(TextInputClient* client) {
if (text_input_client_ != client)
return;
- SetFocusedTextInputClientInternal(NULL);
+ SetFocusedTextInputClientInternal(nullptr);
}
TextInputClient* InputMethodBase::GetTextInputClient() const {
@@ -131,7 +136,7 @@ void InputMethodBase::SetFocusedTextInputClientInternal(
if (old == client)
return;
OnWillChangeFocusedClient(old, client);
- text_input_client_ = client; // NULL allowed.
+ text_input_client_ = client; // nullptr allowed.
OnDidChangeFocusedClient(old, client);
NotifyTextInputStateChanged(text_input_client_);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698