Index: ui/wm/core/focus_controller.cc |
diff --git a/ui/wm/core/focus_controller.cc b/ui/wm/core/focus_controller.cc |
index f4d3f3fb8feaa1502400d40ca3c0266cce9bab95..b03322fbc69104f5bfd203fa10d59c0a747c1290 100644 |
--- a/ui/wm/core/focus_controller.cc |
+++ b/ui/wm/core/focus_controller.cc |
@@ -10,6 +10,7 @@ |
#include "ui/aura/client/focus_change_observer.h" |
#include "ui/aura/env.h" |
#include "ui/aura/window_tracker.h" |
+#include "ui/base/ime/text_input_focus_manager.h" |
#include "ui/events/event.h" |
#include "ui/wm/core/focus_rules.h" |
#include "ui/wm/core/window_util.h" |
@@ -133,6 +134,14 @@ void FocusController::FocusWindow(aura::Window* window) { |
return; |
DCHECK((focusable && activatable) || !window); |
+ // |window| is going to get the focus, so reset the text input client. |
+ // SetActiveWindow() and/or SetFocusedWindow() may set a proper text input |
+ // client if the implementation supports text input. |
+ ui::TextInputFocusManager* text_input_focus_manager = |
+ ui::TextInputFocusManager::GetInstance(); |
+ if (window) |
+ text_input_focus_manager->FocusTextInputClient(NULL); |
sky
2014/04/25 18:20:21
Shouldn't all this be in SetFocusedWindow?
Yuki
2014/04/28 12:59:29
You're right. Moved.
|
+ |
// Activation change observers may change the focused window. If this happens |
// we must not adjust the focus below since this will clobber that change. |
aura::Window* last_focused_window = focused_window_; |
@@ -147,6 +156,10 @@ void FocusController::FocusWindow(aura::Window* window) { |
DCHECK(active_window_->Contains(focusable)); |
SetFocusedWindow(focusable); |
} |
+ |
+ // Ensure that the text input client is reset when the window loses the focus. |
+ if (!window) |
+ text_input_focus_manager->FocusTextInputClient(NULL); |
} |
void FocusController::ResetFocusWithinActiveWindow(aura::Window* window) { |