| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/aura/desktop.h" | 5 #include "ui/aura/desktop.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 void Desktop::SetActiveWindow(Window* window, Window* to_focus) { | 356 void Desktop::SetActiveWindow(Window* window, Window* to_focus) { |
| 357 // We only allow top level windows to be active. | 357 // We only allow top level windows to be active. |
| 358 if (window && window != window->GetToplevelWindow()) { | 358 if (window && window != window->GetToplevelWindow()) { |
| 359 // Ignore requests to activate windows that aren't in a top level window. | 359 // Ignore requests to activate windows that aren't in a top level window. |
| 360 return; | 360 return; |
| 361 } | 361 } |
| 362 | 362 |
| 363 if (active_window_ == window) | 363 if (active_window_ == window) |
| 364 return; | 364 return; |
| 365 if (active_window_ && active_window_->delegate()) | 365 Window* old_active = active_window_; |
| 366 active_window_->delegate()->OnLostActive(); | |
| 367 active_window_ = window; | 366 active_window_ = window; |
| 367 // Invoke OnLostActive after we've changed the active window. That way if the |
| 368 // delegate queries for active state it doesn't think the window is still |
| 369 // active. |
| 370 if (old_active && old_active->delegate()) |
| 371 old_active->delegate()->OnLostActive(); |
| 368 if (active_window_) { | 372 if (active_window_) { |
| 369 active_window_->parent()->MoveChildToFront(active_window_); | 373 active_window_->parent()->MoveChildToFront(active_window_); |
| 370 if (active_window_->delegate()) | 374 if (active_window_->delegate()) |
| 371 active_window_->delegate()->OnActivated(); | 375 active_window_->delegate()->OnActivated(); |
| 372 active_window_->GetFocusManager()->SetFocusedWindow( | 376 active_window_->GetFocusManager()->SetFocusedWindow( |
| 373 to_focus ? to_focus : active_window_); | 377 to_focus ? to_focus : active_window_); |
| 374 } | 378 } |
| 375 FOR_EACH_OBSERVER(DesktopObserver, observers_, | 379 FOR_EACH_OBSERVER(DesktopObserver, observers_, |
| 376 OnActiveWindowChanged(active_window_)); | 380 OnActiveWindowChanged(active_window_)); |
| 377 } | 381 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { | 607 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { |
| 604 bounds.set_size(gfx::Size(parsed_width, parsed_height)); | 608 bounds.set_size(gfx::Size(parsed_width, parsed_height)); |
| 605 } else if (use_fullscreen_host_window_) { | 609 } else if (use_fullscreen_host_window_) { |
| 606 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); | 610 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); |
| 607 } | 611 } |
| 608 | 612 |
| 609 return bounds; | 613 return bounds; |
| 610 } | 614 } |
| 611 | 615 |
| 612 } // namespace aura | 616 } // namespace aura |
| OLD | NEW |