Chromium Code Reviews| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 } | 352 } |
| 353 | 353 |
| 354 bool RootWindowController::HasShelf() { | 354 bool RootWindowController::HasShelf() { |
| 355 return wm_shelf_->shelf_widget() != nullptr; | 355 return wm_shelf_->shelf_widget() != nullptr; |
| 356 } | 356 } |
| 357 | 357 |
| 358 WmShelf* RootWindowController::GetShelf() { | 358 WmShelf* RootWindowController::GetShelf() { |
| 359 return wm_shelf_.get(); | 359 return wm_shelf_.get(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void RootWindowController::CreateShelfView() { | 362 void RootWindowController::InitializeShelf() { |
| 363 if (wm_shelf_->IsShelfInitialized()) | 363 if (shelf_initialized_) |
| 364 return; | 364 return; |
| 365 wm_shelf_->CreateShelfView(); | 365 shelf_initialized_ = true; |
| 366 wm_shelf_->NotifyShelfInitialized(); | |
| 366 | 367 |
| 367 // TODO(jamescook): Pass |wm_shelf_| into the constructors for these layout | 368 // TODO(jamescook): Pass |wm_shelf_| into the constructors for these layout |
| 368 // managers. | 369 // managers. |
| 369 if (panel_layout_manager_) | 370 if (panel_layout_manager_) |
| 370 panel_layout_manager_->SetShelf(wm_shelf_.get()); | 371 panel_layout_manager_->SetShelf(wm_shelf_.get()); |
| 371 | 372 |
| 372 // Notify shell observers that the shelf has been created. | 373 // TODO(jamescook): Eliminate this. Refactor AttachedPanelWidgetTargeter's |
| 373 // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will | 374 // access to WmShelf. |
| 374 // require changing AttachedPanelWidgetTargeter's access to WmShelf. | |
| 375 Shell::Get()->NotifyShelfCreatedForRootWindow(WmWindow::Get(GetRootWindow())); | 375 Shell::Get()->NotifyShelfCreatedForRootWindow(WmWindow::Get(GetRootWindow())); |
| 376 | 376 |
| 377 wm_shelf_->shelf_widget()->PostCreateShelf(); | 377 wm_shelf_->shelf_widget()->PostCreateShelf(); |
| 378 } | 378 } |
| 379 | 379 |
| 380 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 380 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 381 return wm_shelf_->shelf_layout_manager(); | 381 return wm_shelf_->shelf_layout_manager(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 SystemModalContainerLayoutManager* | 384 SystemModalContainerLayoutManager* |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 594 while (!root->GetChildren().empty()) { | 594 while (!root->GetChildren().empty()) { |
| 595 WmWindow* child = root->GetChildren()[0]; | 595 WmWindow* child = root->GetChildren()[0]; |
| 596 if (ShouldDestroyWindowInCloseChildWindows(child)) | 596 if (ShouldDestroyWindowInCloseChildWindows(child)) |
| 597 child->Destroy(); | 597 child->Destroy(); |
| 598 else | 598 else |
| 599 root->RemoveChild(child); | 599 root->RemoveChild(child); |
| 600 } | 600 } |
| 601 | 601 |
| 602 shelf->DestroyShelfWidget(); | 602 shelf->DestroyShelfWidget(); |
| 603 | 603 |
| 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); | 604 aura::client::SetDragDropClient(GetRootWindow(), nullptr); |
| 610 aura::client::SetTooltipClient(GetRootWindow(), nullptr); | 605 aura::client::SetTooltipClient(GetRootWindow(), nullptr); |
| 611 } | 606 } |
| 612 | 607 |
| 613 void RootWindowController::MoveWindowsTo(aura::Window* dst) { | 608 void RootWindowController::MoveWindowsTo(aura::Window* dst) { |
| 614 // Clear the workspace controller, so it doesn't incorrectly update the shelf. | 609 // Clear the workspace controller, so it doesn't incorrectly update the shelf. |
| 615 workspace_controller_.reset(); | 610 workspace_controller_.reset(); |
| 616 ReparentAllWindows(GetRootWindow(), dst); | 611 ReparentAllWindows(GetRootWindow(), dst); |
| 617 } | 612 } |
| 618 | 613 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 | 755 |
| 761 shell->AddShellObserver(this); | 756 shell->AddShellObserver(this); |
| 762 | 757 |
| 763 root_window_layout_manager_->OnWindowResized(); | 758 root_window_layout_manager_->OnWindowResized(); |
| 764 if (root_window_type == RootWindowType::PRIMARY) { | 759 if (root_window_type == RootWindowType::PRIMARY) { |
| 765 if (Shell::GetAshConfig() != Config::MASH) | 760 if (Shell::GetAshConfig() != Config::MASH) |
| 766 shell->InitKeyboard(); | 761 shell->InitKeyboard(); |
| 767 } else { | 762 } else { |
| 768 window_tree_host_->Show(); | 763 window_tree_host_->Show(); |
| 769 | 764 |
| 770 // Create a shelf if a user is already logged in. | 765 // At the login screen the shelf will be hidden because its container |
| 771 if (shell->session_controller()->NumberOfLoggedInUsers()) | 766 // window is hidden. |
|
msw
2017/05/16 22:42:00
nit: Maybe tie this comment into Shelf init? (eg.
James Cook
2017/05/17 16:16:12
Done.
| |
| 772 CreateShelfView(); | 767 InitializeShelf(); |
| 773 | 768 |
| 774 // Notify shell observers about new root window. | 769 // Notify shell observers about new root window. |
| 775 shell->OnRootWindowAdded(WmWindow::Get(root_window)); | 770 shell->OnRootWindowAdded(WmWindow::Get(root_window)); |
| 776 } | 771 } |
| 777 | 772 |
| 778 // TODO: AshTouchExplorationManager doesn't work with mus. | 773 // TODO: AshTouchExplorationManager doesn't work with mus. |
| 779 // http://crbug.com/679782 | 774 // http://crbug.com/679782 |
| 780 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 775 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 781 switches::kAshDisableTouchExplorationMode) && | 776 switches::kAshDisableTouchExplorationMode) && |
| 782 Shell::GetAshConfig() != Config::MASH) { | 777 Shell::GetAshConfig() != Config::MASH) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1097 EnableTouchHudProjection(); | 1092 EnableTouchHudProjection(); |
| 1098 else | 1093 else |
| 1099 DisableTouchHudProjection(); | 1094 DisableTouchHudProjection(); |
| 1100 } | 1095 } |
| 1101 | 1096 |
| 1102 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1097 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
| 1103 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1098 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
| 1104 } | 1099 } |
| 1105 | 1100 |
| 1106 } // namespace ash | 1101 } // namespace ash |
| OLD | NEW |