Chromium Code Reviews| 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..37af32e6ea2f17130be79b5d0d0745c408077274 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" |
| @@ -230,6 +231,15 @@ void FocusController::SetFocusedWindow(aura::Window* window) { |
| base::AutoReset<bool> updating_focus(&updating_focus_, true); |
| aura::Window* lost_focus = focused_window_; |
| + |
| + // |window| is going to get the focus, so reset the text input client. |
| + // OnWindowFocused() 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); |
| + |
| // Allow for the window losing focus to be deleted during dispatch. If it is |
| // deleted pass NULL to observers instead of a deleted window. |
| aura::WindowTracker window_tracker; |
| @@ -261,6 +271,10 @@ void FocusController::SetFocusedWindow(aura::Window* window) { |
| focused_window_, |
| window_tracker.Contains(lost_focus) ? lost_focus : NULL); |
| } |
| + |
| + // Ensure that the text input client is reset when the window loses the focus. |
| + if (!window) |
| + text_input_focus_manager->FocusTextInputClient(NULL); |
|
msw
2014/05/02 18:46:03
nit: the value of |window| doesn't change from lin
Yuki
2014/05/07 05:58:02
Some observers above might change the focused text
|
| } |
| void FocusController::SetActiveWindow(aura::Window* requested_window, |