| 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/aura/aura_layout_manager_adapter.h" | 10 #include "ash/aura/aura_layout_manager_adapter.h" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 454 |
| 455 aura::Window* RootWindowController::GetContainer(int container_id) { | 455 aura::Window* RootWindowController::GetContainer(int container_id) { |
| 456 return GetRootWindow()->GetChildById(container_id); | 456 return GetRootWindow()->GetChildById(container_id); |
| 457 } | 457 } |
| 458 | 458 |
| 459 const aura::Window* RootWindowController::GetContainer(int container_id) const { | 459 const aura::Window* RootWindowController::GetContainer(int container_id) const { |
| 460 return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id); | 460 return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void RootWindowController::ShowShelf() { | 463 void RootWindowController::ShowShelf() { |
| 464 if (!shelf_) | 464 if (!shelf_widget_) |
| 465 return; | 465 return; |
| 466 shelf_widget_->SetShelfVisibility(true); | 466 shelf_widget_->SetShelfVisibility(true); |
| 467 shelf_widget_->status_area_widget()->Show(); | 467 shelf_widget_->status_area_widget()->Show(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 void RootWindowController::CreateShelf() { | 470 void RootWindowController::CreateShelf() { |
| 471 if (shelf_) | 471 if (wm_shelf_aura_->shelf()) |
| 472 return; | 472 return; |
| 473 ShelfView* shelf_view = shelf_widget_->CreateShelfView(); | 473 Shelf* shelf = |
| 474 | 474 new Shelf(wm_shelf_aura_.get(), shelf_widget_->CreateShelfView(), |
| 475 shelf_.reset( | 475 shelf_widget_.get()); |
| 476 new Shelf(wm_shelf_aura_.get(), shelf_view, shelf_widget_.get())); | 476 shelf_widget_->set_shelf(shelf); |
| 477 shelf_widget_->set_shelf(shelf_.get()); | |
| 478 // Must be initialized before the delegate is notified because the delegate | 477 // Must be initialized before the delegate is notified because the delegate |
| 479 // may try to access the WmShelf. | 478 // may try to access the WmShelf. |
| 480 wm_shelf_aura_->SetShelf(shelf_.get()); | 479 wm_shelf_aura_->SetShelf(base::WrapUnique(shelf)); |
| 481 WmShell::Get()->shelf_delegate()->OnShelfCreated(shelf_.get()); | 480 WmShell::Get()->shelf_delegate()->OnShelfCreated(shelf); |
| 482 | 481 |
| 483 if (panel_layout_manager_) | 482 if (panel_layout_manager_) |
| 484 panel_layout_manager_->SetShelf(wm_shelf_aura_.get()); | 483 panel_layout_manager_->SetShelf(wm_shelf_aura_.get()); |
| 485 if (docked_layout_manager_) { | 484 if (docked_layout_manager_) { |
| 486 docked_layout_manager_->SetShelf(wm_shelf_aura_.get()); | 485 docked_layout_manager_->SetShelf(wm_shelf_aura_.get()); |
| 487 if (shelf_widget_->shelf_layout_manager()) | 486 if (shelf_widget_->shelf_layout_manager()) |
| 488 docked_layout_manager_->AddObserver( | 487 docked_layout_manager_->AddObserver( |
| 489 shelf_widget_->shelf_layout_manager()); | 488 shelf_widget_->shelf_layout_manager()); |
| 490 } | 489 } |
| 491 | 490 |
| 492 // Notify shell observers that the shelf has been created. | 491 // Notify shell observers that the shelf has been created. |
| 493 WmShell::Get()->NotifyShelfCreatedForRootWindow( | 492 WmShell::Get()->NotifyShelfCreatedForRootWindow( |
| 494 WmWindowAura::Get(GetRootWindow())); | 493 WmWindowAura::Get(GetRootWindow())); |
| 495 | 494 |
| 496 shelf_widget_->PostCreateShelf(); | 495 shelf_widget_->PostCreateShelf(); |
| 497 } | 496 } |
| 498 | 497 |
| 499 Shelf* RootWindowController::GetShelf() const { | 498 Shelf* RootWindowController::GetShelf() const { |
| 500 return shelf_.get(); | 499 return wm_shelf_aura_->shelf(); |
| 501 } | 500 } |
| 502 | 501 |
| 503 void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) { | 502 void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) { |
| 504 if (status != LoginStatus::NOT_LOGGED_IN) | 503 if (status != LoginStatus::NOT_LOGGED_IN) |
| 505 mouse_event_target_.reset(); | 504 mouse_event_target_.reset(); |
| 506 if (shelf_widget_->status_area_widget()) | 505 if (shelf_widget_->status_area_widget()) |
| 507 shelf_widget_->status_area_widget()->UpdateAfterLoginStatusChange(status); | 506 shelf_widget_->status_area_widget()->UpdateAfterLoginStatusChange(status); |
| 508 } | 507 } |
| 509 | 508 |
| 510 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { | 509 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 if (docked_layout_manager_) { | 567 if (docked_layout_manager_) { |
| 569 docked_layout_manager_->Shutdown(); | 568 docked_layout_manager_->Shutdown(); |
| 570 docked_layout_manager_ = NULL; | 569 docked_layout_manager_ = NULL; |
| 571 } | 570 } |
| 572 aura::Window* root_window = GetRootWindow(); | 571 aura::Window* root_window = GetRootWindow(); |
| 573 aura::client::SetDragDropClient(root_window, NULL); | 572 aura::client::SetDragDropClient(root_window, NULL); |
| 574 | 573 |
| 575 if (shelf_widget_) | 574 if (shelf_widget_) |
| 576 shelf_widget_->Shutdown(); | 575 shelf_widget_->Shutdown(); |
| 577 | 576 |
| 578 wm_shelf_aura_->Shutdown(); | 577 wm_shelf_aura_->SetShelfLayoutManager(nullptr); |
| 579 | 578 |
| 580 // Close background widget first as it depends on tooltip. | 579 // Close background widget first as it depends on tooltip. |
| 581 wallpaper_controller_.reset(); | 580 wallpaper_controller_.reset(); |
| 582 animating_wallpaper_controller_.reset(); | 581 animating_wallpaper_controller_.reset(); |
| 583 | 582 |
| 584 workspace_controller_.reset(); | 583 workspace_controller_.reset(); |
| 585 aura::client::SetTooltipClient(root_window, NULL); | 584 aura::client::SetTooltipClient(root_window, NULL); |
| 586 | 585 |
| 587 // Explicitly destroy top level windows. We do this as during part of | 586 // Explicitly destroy top level windows. We do this as during part of |
| 588 // destruction such windows may query the RootWindow for state. | 587 // destruction such windows may query the RootWindow for state. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 609 while (!root_window->children().empty()) { | 608 while (!root_window->children().empty()) { |
| 610 aura::Window* window = root_window->children()[0]; | 609 aura::Window* window = root_window->children()[0]; |
| 611 if (window->owned_by_parent()) { | 610 if (window->owned_by_parent()) { |
| 612 delete window; | 611 delete window; |
| 613 } else { | 612 } else { |
| 614 root_window->RemoveChild(window); | 613 root_window->RemoveChild(window); |
| 615 } | 614 } |
| 616 } | 615 } |
| 617 | 616 |
| 618 shelf_widget_.reset(); | 617 shelf_widget_.reset(); |
| 619 shelf_.reset(); | 618 wm_shelf_aura_->SetShelf(nullptr); |
| 620 } | 619 } |
| 621 | 620 |
| 622 void RootWindowController::MoveWindowsTo(aura::Window* dst) { | 621 void RootWindowController::MoveWindowsTo(aura::Window* dst) { |
| 623 // Clear the workspace controller, so it doesn't incorrectly update the shelf. | 622 // Clear the workspace controller, so it doesn't incorrectly update the shelf. |
| 624 workspace_controller_.reset(); | 623 workspace_controller_.reset(); |
| 625 ReparentAllWindows(GetRootWindow(), dst); | 624 ReparentAllWindows(GetRootWindow(), dst); |
| 626 } | 625 } |
| 627 | 626 |
| 628 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 627 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 629 return shelf_widget_->shelf_layout_manager(); | 628 return shelf_widget_->shelf_layout_manager(); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 aura::Window* primary_root_window = Shell::GetInstance() | 956 aura::Window* primary_root_window = Shell::GetInstance() |
| 958 ->window_tree_host_manager() | 957 ->window_tree_host_manager() |
| 959 ->GetPrimaryRootWindow(); | 958 ->GetPrimaryRootWindow(); |
| 960 return GetRootWindowSettings(primary_root_window)->controller; | 959 return GetRootWindowSettings(primary_root_window)->controller; |
| 961 } | 960 } |
| 962 | 961 |
| 963 return GetRootWindowSettings(root_window)->controller; | 962 return GetRootWindowSettings(root_window)->controller; |
| 964 } | 963 } |
| 965 | 964 |
| 966 } // namespace ash | 965 } // namespace ash |
| OLD | NEW |