| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/wm_root_window_controller.h" | 5 #include "ash/common/wm_root_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 8 #include "ash/common/shelf/shelf_layout_manager.h" |
| 8 #include "ash/common/shelf/shelf_widget.h" | 9 #include "ash/common/shelf/shelf_widget.h" |
| 9 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/shell_delegate.h" | 11 #include "ash/common/shell_delegate.h" |
| 11 #include "ash/common/shell_window_ids.h" | 12 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/common/system/status_area_widget.h" | 13 #include "ash/common/system/status_area_widget.h" |
| 13 #include "ash/common/wallpaper/wallpaper_delegate.h" | 14 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 14 #include "ash/common/wallpaper/wallpaper_widget_controller.h" | 15 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
| 15 #include "ash/common/wm/always_on_top_controller.h" | 16 #include "ash/common/wm/always_on_top_controller.h" |
| 16 #include "ash/common/wm/container_finder.h" | 17 #include "ash/common/wm/container_finder.h" |
| 17 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 18 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() | 186 WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() |
| 186 ? kShellWindowId_LockSystemModalContainer | 187 ? kShellWindowId_LockSystemModalContainer |
| 187 : kShellWindowId_SystemModalContainer; | 188 : kShellWindowId_SystemModalContainer; |
| 188 modal_container = GetContainer(modal_window_id); | 189 modal_container = GetContainer(modal_window_id); |
| 189 } | 190 } |
| 190 return modal_container ? static_cast<SystemModalContainerLayoutManager*>( | 191 return modal_container ? static_cast<SystemModalContainerLayoutManager*>( |
| 191 modal_container->GetLayoutManager()) | 192 modal_container->GetLayoutManager()) |
| 192 : nullptr; | 193 : nullptr; |
| 193 } | 194 } |
| 194 | 195 |
| 196 void WmRootWindowController::CreateShelf() { |
| 197 WmShelf* shelf = GetShelf(); |
| 198 if (shelf->IsShelfInitialized()) |
| 199 return; |
| 200 shelf->InitializeShelf(); |
| 201 |
| 202 if (panel_layout_manager_) |
| 203 panel_layout_manager_->SetShelf(shelf); |
| 204 if (docked_window_layout_manager_) { |
| 205 docked_window_layout_manager_->SetShelf(shelf); |
| 206 if (shelf->shelf_layout_manager()) |
| 207 docked_window_layout_manager_->AddObserver(shelf->shelf_layout_manager()); |
| 208 } |
| 209 |
| 210 // Notify shell observers that the shelf has been created. |
| 211 // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will |
| 212 // require changing AttachedPanelWidgetTargeter's access to WmShelf. |
| 213 WmShell::Get()->NotifyShelfCreatedForRootWindow(GetWindow()); |
| 214 |
| 215 shelf->shelf_widget()->PostCreateShelf(); |
| 216 } |
| 217 |
| 195 void WmRootWindowController::ShowShelf() { | 218 void WmRootWindowController::ShowShelf() { |
| 196 WmShelf* shelf = GetShelf(); | 219 WmShelf* shelf = GetShelf(); |
| 197 if (!shelf->IsShelfInitialized()) | 220 if (!shelf->IsShelfInitialized()) |
| 198 return; | 221 return; |
| 199 // TODO(jamescook): Move this into WmShelf. | 222 // TODO(jamescook): Move this into WmShelf. |
| 200 shelf->shelf_widget()->SetShelfVisibility(true); | 223 shelf->shelf_widget()->SetShelfVisibility(true); |
| 201 shelf->shelf_widget()->status_area_widget()->Show(); | 224 shelf->shelf_widget()->status_area_widget()->Show(); |
| 202 } | 225 } |
| 203 | 226 |
| 204 WmWindow* WmRootWindowController::GetContainer(int container_id) { | 227 WmWindow* WmRootWindowController::GetContainer(int container_id) { |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 } | 578 } |
| 556 | 579 |
| 557 void WmRootWindowController::OnMenuClosed() { | 580 void WmRootWindowController::OnMenuClosed() { |
| 558 menu_runner_.reset(); | 581 menu_runner_.reset(); |
| 559 menu_model_adapter_.reset(); | 582 menu_model_adapter_.reset(); |
| 560 menu_model_.reset(); | 583 menu_model_.reset(); |
| 561 GetShelf()->UpdateVisibilityState(); | 584 GetShelf()->UpdateVisibilityState(); |
| 562 } | 585 } |
| 563 | 586 |
| 564 } // namespace ash | 587 } // namespace ash |
| OLD | NEW |