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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // Remove all toplevel windows first. |
441 std::queue<aura::Window*> non_toplevel_windows; | 441 std::queue<aura::Window*> non_toplevel_windows; |
442 non_toplevel_windows.push(root_window_.get()); | 442 non_toplevel_windows.push(root_window_.get()); |
443 while (!non_toplevel_windows.empty()) { | 443 while (!non_toplevel_windows.empty()) { |
444 aura::Window* non_toplevel_window = non_toplevel_windows.front(); | 444 aura::Window* non_toplevel_window = non_toplevel_windows.front(); |
445 non_toplevel_windows.pop(); | 445 non_toplevel_windows.pop(); |
446 aura::WindowTracker toplevel_windows; | 446 aura::WindowTracker toplevel_windows; |
447 for (size_t i = 0; i < non_toplevel_window->children().size(); ++i) { | 447 for (size_t i = 0; i < non_toplevel_window->children().size(); ++i) { |
448 aura::Window* child = non_toplevel_window->children()[i]; | 448 aura::Window* child = non_toplevel_window->children()[i]; |
oshima
2013/09/30 22:48:57
can't we skip here like
if (child->owned_by_paren
sky
2013/09/30 23:14:17
Done.
| |
449 if (child->delegate()) | 449 if (child->delegate()) |
450 toplevel_windows.Add(child); | 450 toplevel_windows.Add(child); |
451 else | 451 else |
452 non_toplevel_windows.push(child); | 452 non_toplevel_windows.push(child); |
453 } | 453 } |
454 while (!toplevel_windows.windows().empty()) | 454 while (!toplevel_windows.windows().empty()) { |
455 delete *toplevel_windows.windows().begin(); | 455 aura::Window* window = *(toplevel_windows.windows().begin()); |
456 if (window->owned_by_parent()) { | |
457 delete window; | |
458 } else { | |
459 toplevel_windows.Remove(window); | |
460 window->parent()->RemoveChild(window); | |
461 } | |
462 } | |
456 } | 463 } |
457 // And then remove the containers. | 464 // And then remove the containers. |
458 while (!root_window_->children().empty()) | 465 while (!root_window_->children().empty()) { |
459 delete root_window_->children()[0]; | 466 aura::Window* window = root_window_->children()[0]; |
467 if (window->owned_by_parent()) { | |
468 delete window; | |
469 } else { | |
470 root_window_->RemoveChild(window); | |
471 } | |
472 } | |
460 | 473 |
461 shelf_.reset(NULL); | 474 shelf_.reset(NULL); |
462 } | 475 } |
463 | 476 |
464 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 477 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
465 // Forget the shelf early so that shelf don't update itself using wrong | 478 // Forget the shelf early so that shelf don't update itself using wrong |
466 // display info. | 479 // display info. |
467 workspace_controller_->SetShelf(NULL); | 480 workspace_controller_->SetShelf(NULL); |
468 ReparentAllWindows(root_window_.get(), dst); | 481 ReparentAllWindows(root_window_.get(), dst); |
469 } | 482 } |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 DisableTouchHudProjection(); | 837 DisableTouchHudProjection(); |
825 } | 838 } |
826 | 839 |
827 RootWindowController* GetRootWindowController( | 840 RootWindowController* GetRootWindowController( |
828 const aura::RootWindow* root_window) { | 841 const aura::RootWindow* root_window) { |
829 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 842 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
830 } | 843 } |
831 | 844 |
832 } // namespace internal | 845 } // namespace internal |
833 } // namespace ash | 846 } // namespace ash |
OLD | NEW |