| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 const WmWindow* RootWindowController::GetWindow() const { | 345 const WmWindow* RootWindowController::GetWindow() const { |
| 346 return WmWindow::Get(GetRootWindow()); | 346 return WmWindow::Get(GetRootWindow()); |
| 347 } | 347 } |
| 348 | 348 |
| 349 wm::WorkspaceWindowState RootWindowController::GetWorkspaceWindowState() { | 349 wm::WorkspaceWindowState RootWindowController::GetWorkspaceWindowState() { |
| 350 return workspace_controller_ ? workspace_controller()->GetWindowState() | 350 return workspace_controller_ ? workspace_controller()->GetWindowState() |
| 351 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; | 351 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; |
| 352 } | 352 } |
| 353 | 353 |
| 354 bool RootWindowController::HasShelf() { | 354 void RootWindowController::InitializeShelf() { |
| 355 return wm_shelf_->shelf_widget() != nullptr; | 355 if (shelf_initialized_) |
| 356 } | |
| 357 | |
| 358 WmShelf* RootWindowController::GetShelf() { | |
| 359 return wm_shelf_.get(); | |
| 360 } | |
| 361 | |
| 362 void RootWindowController::CreateShelfView() { | |
| 363 if (wm_shelf_->IsShelfInitialized()) | |
| 364 return; | 356 return; |
| 365 wm_shelf_->CreateShelfView(); | 357 shelf_initialized_ = true; |
| 358 wm_shelf_->NotifyShelfInitialized(); |
| 366 | 359 |
| 367 // TODO(jamescook): Pass |wm_shelf_| into the constructors for these layout | 360 // TODO(jamescook): Pass |wm_shelf_| into the constructors for these layout |
| 368 // managers. | 361 // managers. |
| 369 if (panel_layout_manager_) | 362 if (panel_layout_manager_) |
| 370 panel_layout_manager_->SetShelf(wm_shelf_.get()); | 363 panel_layout_manager_->SetShelf(wm_shelf_.get()); |
| 371 | 364 |
| 372 // Notify shell observers that the shelf has been created. | 365 // TODO(jamescook): Eliminate this. Refactor AttachedPanelWidgetTargeter's |
| 373 // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will | 366 // access to WmShelf. |
| 374 // require changing AttachedPanelWidgetTargeter's access to WmShelf. | |
| 375 Shell::Get()->NotifyShelfCreatedForRootWindow(WmWindow::Get(GetRootWindow())); | 367 Shell::Get()->NotifyShelfCreatedForRootWindow(WmWindow::Get(GetRootWindow())); |
| 376 | 368 |
| 377 wm_shelf_->shelf_widget()->PostCreateShelf(); | 369 wm_shelf_->shelf_widget()->PostCreateShelf(); |
| 378 } | 370 } |
| 379 | 371 |
| 380 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 372 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 381 return wm_shelf_->shelf_layout_manager(); | 373 return wm_shelf_->shelf_layout_manager(); |
| 382 } | 374 } |
| 383 | 375 |
| 384 SystemModalContainerLayoutManager* | 376 SystemModalContainerLayoutManager* |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 while (!root->GetChildren().empty()) { | 586 while (!root->GetChildren().empty()) { |
| 595 WmWindow* child = root->GetChildren()[0]; | 587 WmWindow* child = root->GetChildren()[0]; |
| 596 if (ShouldDestroyWindowInCloseChildWindows(child)) | 588 if (ShouldDestroyWindowInCloseChildWindows(child)) |
| 597 child->Destroy(); | 589 child->Destroy(); |
| 598 else | 590 else |
| 599 root->RemoveChild(child); | 591 root->RemoveChild(child); |
| 600 } | 592 } |
| 601 | 593 |
| 602 shelf->DestroyShelfWidget(); | 594 shelf->DestroyShelfWidget(); |
| 603 | 595 |
| 604 // CloseChildWindows() may be called twice during the shutdown of ash | |
| 605 // unittests. Avoid notifying WmShelf that the shelf has been destroyed twice. | |
| 606 if (shelf->IsShelfInitialized()) | |
| 607 shelf->ShutdownShelf(); | |
| 608 | |
| 609 aura::client::SetDragDropClient(GetRootWindow(), nullptr); | 596 aura::client::SetDragDropClient(GetRootWindow(), nullptr); |
| 610 aura::client::SetTooltipClient(GetRootWindow(), nullptr); | 597 aura::client::SetTooltipClient(GetRootWindow(), nullptr); |
| 611 } | 598 } |
| 612 | 599 |
| 613 void RootWindowController::MoveWindowsTo(aura::Window* dst) { | 600 void RootWindowController::MoveWindowsTo(aura::Window* dst) { |
| 614 // Clear the workspace controller, so it doesn't incorrectly update the shelf. | 601 // Clear the workspace controller, so it doesn't incorrectly update the shelf. |
| 615 workspace_controller_.reset(); | 602 workspace_controller_.reset(); |
| 616 ReparentAllWindows(GetRootWindow(), dst); | 603 ReparentAllWindows(GetRootWindow(), dst); |
| 617 } | 604 } |
| 618 | 605 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 | 747 |
| 761 shell->AddShellObserver(this); | 748 shell->AddShellObserver(this); |
| 762 | 749 |
| 763 root_window_layout_manager_->OnWindowResized(); | 750 root_window_layout_manager_->OnWindowResized(); |
| 764 if (root_window_type == RootWindowType::PRIMARY) { | 751 if (root_window_type == RootWindowType::PRIMARY) { |
| 765 if (Shell::GetAshConfig() != Config::MASH) | 752 if (Shell::GetAshConfig() != Config::MASH) |
| 766 shell->InitKeyboard(); | 753 shell->InitKeyboard(); |
| 767 } else { | 754 } else { |
| 768 window_tree_host_->Show(); | 755 window_tree_host_->Show(); |
| 769 | 756 |
| 770 // Create a shelf if a user is already logged in. | 757 // At the login screen the shelf will be hidden because its container window |
| 771 if (shell->session_controller()->NumberOfLoggedInUsers()) | 758 // is hidden. InitializeShelf() will make it visible. |
| 772 CreateShelfView(); | 759 InitializeShelf(); |
| 773 | 760 |
| 774 // Notify shell observers about new root window. | 761 // Notify shell observers about new root window. |
| 775 shell->OnRootWindowAdded(WmWindow::Get(root_window)); | 762 shell->OnRootWindowAdded(WmWindow::Get(root_window)); |
| 776 } | 763 } |
| 777 | 764 |
| 778 // TODO: AshTouchExplorationManager doesn't work with mus. | 765 // TODO: AshTouchExplorationManager doesn't work with mus. |
| 779 // http://crbug.com/679782 | 766 // http://crbug.com/679782 |
| 780 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 767 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 781 switches::kAshDisableTouchExplorationMode) && | 768 switches::kAshDisableTouchExplorationMode) && |
| 782 Shell::GetAshConfig() != Config::MASH) { | 769 Shell::GetAshConfig() != Config::MASH) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 EnableTouchHudProjection(); | 1084 EnableTouchHudProjection(); |
| 1098 else | 1085 else |
| 1099 DisableTouchHudProjection(); | 1086 DisableTouchHudProjection(); |
| 1100 } | 1087 } |
| 1101 | 1088 |
| 1102 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1089 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
| 1103 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1090 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
| 1104 } | 1091 } |
| 1105 | 1092 |
| 1106 } // namespace ash | 1093 } // namespace ash |
| OLD | NEW |