Index: ui/aura/desktop.cc |
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc |
index 2c747d28beb72b28eb1182e205bcfd9f37ff51e2..a6c909a87aa6994a7f3b7d31b088fbc7fcc6def8 100644 |
--- a/ui/aura/desktop.cc |
+++ b/ui/aura/desktop.cc |
@@ -362,9 +362,13 @@ void Desktop::SetActiveWindow(Window* window, Window* to_focus) { |
if (active_window_ == window) |
return; |
- if (active_window_ && active_window_->delegate()) |
- active_window_->delegate()->OnLostActive(); |
+ Window* old_active = active_window_; |
active_window_ = window; |
+ // Invoke OnLostActive after we've changed the active window. That way if the |
+ // delegate queries for active state it doesn't think the window is still |
+ // active. |
+ if (old_active && old_active->delegate()) |
+ old_active->delegate()->OnLostActive(); |
if (active_window_) { |
active_window_->parent()->MoveChildToFront(active_window_); |
if (active_window_->delegate()) |