| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 if (shelf_->shelf_layout_manager()) | 430 if (shelf_->shelf_layout_manager()) |
| 431 shelf_->shelf_layout_manager()->PrepareForShutdown(); | 431 shelf_->shelf_layout_manager()->PrepareForShutdown(); |
| 432 | 432 |
| 433 // Close background widget first as it depends on tooltip. | 433 // Close background widget first as it depends on tooltip. |
| 434 wallpaper_controller_.reset(); | 434 wallpaper_controller_.reset(); |
| 435 animating_wallpaper_controller_.reset(); | 435 animating_wallpaper_controller_.reset(); |
| 436 | 436 |
| 437 workspace_controller_.reset(); | 437 workspace_controller_.reset(); |
| 438 aura::client::SetTooltipClient(root_window_.get(), NULL); | 438 aura::client::SetTooltipClient(root_window_.get(), NULL); |
| 439 | 439 |
| 440 // Remove all toplevel windows first. | 440 // Explicitly destroy top level windows. We do this as during part of |
| 441 // destruction such windows may query the RootWindow for state. |
| 441 std::queue<aura::Window*> non_toplevel_windows; | 442 std::queue<aura::Window*> non_toplevel_windows; |
| 442 non_toplevel_windows.push(root_window_.get()); | 443 non_toplevel_windows.push(root_window_.get()); |
| 443 while (!non_toplevel_windows.empty()) { | 444 while (!non_toplevel_windows.empty()) { |
| 444 aura::Window* non_toplevel_window = non_toplevel_windows.front(); | 445 aura::Window* non_toplevel_window = non_toplevel_windows.front(); |
| 445 non_toplevel_windows.pop(); | 446 non_toplevel_windows.pop(); |
| 446 aura::WindowTracker toplevel_windows; | 447 aura::WindowTracker toplevel_windows; |
| 447 for (size_t i = 0; i < non_toplevel_window->children().size(); ++i) { | 448 for (size_t i = 0; i < non_toplevel_window->children().size(); ++i) { |
| 448 aura::Window* child = non_toplevel_window->children()[i]; | 449 aura::Window* child = non_toplevel_window->children()[i]; |
| 450 if (!child->owned_by_parent()) |
| 451 continue; |
| 449 if (child->delegate()) | 452 if (child->delegate()) |
| 450 toplevel_windows.Add(child); | 453 toplevel_windows.Add(child); |
| 451 else | 454 else |
| 452 non_toplevel_windows.push(child); | 455 non_toplevel_windows.push(child); |
| 453 } | 456 } |
| 454 while (!toplevel_windows.windows().empty()) | 457 while (!toplevel_windows.windows().empty()) |
| 455 delete *toplevel_windows.windows().begin(); | 458 delete *toplevel_windows.windows().begin(); |
| 456 } | 459 } |
| 457 // And then remove the containers. | 460 // And then remove the containers. |
| 458 while (!root_window_->children().empty()) | 461 while (!root_window_->children().empty()) { |
| 459 delete root_window_->children()[0]; | 462 aura::Window* window = root_window_->children()[0]; |
| 463 if (window->owned_by_parent()) { |
| 464 delete window; |
| 465 } else { |
| 466 root_window_->RemoveChild(window); |
| 467 } |
| 468 } |
| 460 | 469 |
| 461 shelf_.reset(NULL); | 470 shelf_.reset(NULL); |
| 462 } | 471 } |
| 463 | 472 |
| 464 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 473 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
| 465 // Forget the shelf early so that shelf don't update itself using wrong | 474 // Forget the shelf early so that shelf don't update itself using wrong |
| 466 // display info. | 475 // display info. |
| 467 workspace_controller_->SetShelf(NULL); | 476 workspace_controller_->SetShelf(NULL); |
| 468 ReparentAllWindows(root_window_.get(), dst); | 477 ReparentAllWindows(root_window_.get(), dst); |
| 469 } | 478 } |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 DisableTouchHudProjection(); | 833 DisableTouchHudProjection(); |
| 825 } | 834 } |
| 826 | 835 |
| 827 RootWindowController* GetRootWindowController( | 836 RootWindowController* GetRootWindowController( |
| 828 const aura::RootWindow* root_window) { | 837 const aura::RootWindow* root_window) { |
| 829 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 838 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
| 830 } | 839 } |
| 831 | 840 |
| 832 } // namespace internal | 841 } // namespace internal |
| 833 } // namespace ash | 842 } // namespace ash |
| OLD | NEW |