Chromium Code Reviews| Index: ui/views/corewm/focus_controller.cc |
| diff --git a/ui/views/corewm/focus_controller.cc b/ui/views/corewm/focus_controller.cc |
| index eaab15101820708b88242137c2ffe4cd836e7915..a4a8d33401fdc10e06246f530834c69e21ecf66c 100644 |
| --- a/ui/views/corewm/focus_controller.cc |
| +++ b/ui/views/corewm/focus_controller.cc |
| @@ -151,7 +151,7 @@ void FocusController::FocusWindow(aura::Window* window) { |
| // we must not adjust the focus below since this will clobber that change. |
| aura::Window* last_focused_window = focused_window_; |
| if (!updating_activation_) |
| - SetActiveWindow(activatable); |
| + SetActiveWindow(window, activatable); |
| // If the window's ActivationChangeObserver shifted focus to a valid window, |
| // we don't want to focus the window we thought would be focused by default. |
| @@ -279,10 +279,19 @@ void FocusController::SetFocusedWindow(aura::Window* window) { |
| observer->OnWindowFocused(focused_window_, lost_focus); |
| } |
| -void FocusController::SetActiveWindow(aura::Window* window) { |
| - if (updating_activation_ || window == active_window_) |
| +void FocusController::SetActiveWindow(aura::Window* requested_window, |
| + aura::Window* window) { |
| + if (updating_activation_) |
| return; |
| + if (window == active_window_) { |
| + FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver, |
|
sky
2013/04/23 21:36:42
I think it's only worth invoking this when request
sschmitz
2013/04/24 01:23:43
Done.
|
| + activation_observers_, |
| + OnAttemptToReactivateWindow(requested_window, |
| + active_window_)); |
| + return; |
| + } |
| + |
| DCHECK(rules_->CanActivateWindow(window)); |
| if (window) |
| DCHECK_EQ(window, rules_->GetActivatableWindow(window)); |
| @@ -326,7 +335,7 @@ void FocusController::WindowLostFocusFromDispositionChange( |
| // that process so there's no point in updating focus independently. |
| if (window == active_window_) { |
| aura::Window* next_activatable = rules_->GetNextActivatableWindow(window); |
| - SetActiveWindow(next_activatable); |
| + SetActiveWindow(NULL, next_activatable); |
| if (!(active_window_ && active_window_->Contains(focused_window_))) |
| SetFocusedWindow(next_activatable); |
| } else if (window->Contains(focused_window_)) { |