| 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/mus/root_window_controller.h" | 5 #include "ash/mus/root_window_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <sstream> | 11 #include <sstream> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "ash/common/root_window_controller_common.h" | 16 #include "ash/common/root_window_controller_common.h" |
| 17 #include "ash/common/session/session_state_delegate.h" | |
| 18 #include "ash/common/shell_window_ids.h" | 17 #include "ash/common/shell_window_ids.h" |
| 19 #include "ash/common/system/status_area_widget.h" | |
| 20 #include "ash/common/wm/always_on_top_controller.h" | 18 #include "ash/common/wm/always_on_top_controller.h" |
| 21 #include "ash/common/wm/container_finder.h" | 19 #include "ash/common/wm/container_finder.h" |
| 22 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 20 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 23 #include "ash/common/wm/panels/panel_layout_manager.h" | 21 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 24 #include "ash/common/wm/root_window_layout_manager.h" | 22 #include "ash/common/wm/root_window_layout_manager.h" |
| 25 #include "ash/common/wm/workspace/workspace_layout_manager.h" | 23 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
| 26 #include "ash/mus/bridge/wm_root_window_controller_mus.h" | 24 #include "ash/mus/bridge/wm_root_window_controller_mus.h" |
| 27 #include "ash/mus/bridge/wm_shelf_mus.h" | 25 #include "ash/mus/bridge/wm_shelf_mus.h" |
| 28 #include "ash/mus/bridge/wm_shell_mus.h" | 26 #include "ash/mus/bridge/wm_shell_mus.h" |
| 29 #include "ash/mus/bridge/wm_window_mus.h" | 27 #include "ash/mus/bridge/wm_window_mus.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 59 window_count_(0), | 57 window_count_(0), |
| 60 display_(display) { | 58 display_(display) { |
| 61 wm_root_window_controller_.reset( | 59 wm_root_window_controller_.reset( |
| 62 new WmRootWindowControllerMus(window_manager_->shell(), this)); | 60 new WmRootWindowControllerMus(window_manager_->shell(), this)); |
| 63 | 61 |
| 64 root_window_controller_common_.reset( | 62 root_window_controller_common_.reset( |
| 65 new RootWindowControllerCommon(WmWindowMus::Get(root_))); | 63 new RootWindowControllerCommon(WmWindowMus::Get(root_))); |
| 66 root_window_controller_common_->CreateContainers(); | 64 root_window_controller_common_->CreateContainers(); |
| 67 root_window_controller_common_->CreateLayoutManagers(); | 65 root_window_controller_common_->CreateLayoutManagers(); |
| 68 CreateLayoutManagers(); | 66 CreateLayoutManagers(); |
| 69 CreateStatusArea(); | |
| 70 | 67 |
| 71 disconnected_app_handler_.reset(new DisconnectedAppHandler(root)); | 68 disconnected_app_handler_.reset(new DisconnectedAppHandler(root)); |
| 72 | 69 |
| 73 // Force a layout of the root, and its children, RootWindowLayout handles | 70 // Force a layout of the root, and its children, RootWindowLayout handles |
| 74 // both. | 71 // both. |
| 75 root_window_controller_common_->root_window_layout()->OnWindowResized(); | 72 root_window_controller_common_->root_window_layout()->OnWindowResized(); |
| 76 | 73 |
| 77 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { | 74 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { |
| 78 window_manager_->window_manager_client()->AddActivationParent( | 75 window_manager_->window_manager_client()->AddActivationParent( |
| 79 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window()); | 76 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window()); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 GetWindowByShellWindowId(kShellWindowId_DockedContainer); | 205 GetWindowByShellWindowId(kShellWindowId_DockedContainer); |
| 209 docked_container->SetLayoutManager( | 206 docked_container->SetLayoutManager( |
| 210 base::WrapUnique(new DockedWindowLayoutManager(docked_container))); | 207 base::WrapUnique(new DockedWindowLayoutManager(docked_container))); |
| 211 | 208 |
| 212 WmWindowMus* panel_container = | 209 WmWindowMus* panel_container = |
| 213 GetWindowByShellWindowId(kShellWindowId_PanelContainer); | 210 GetWindowByShellWindowId(kShellWindowId_PanelContainer); |
| 214 panel_container->SetLayoutManager( | 211 panel_container->SetLayoutManager( |
| 215 base::WrapUnique(new PanelLayoutManager(panel_container))); | 212 base::WrapUnique(new PanelLayoutManager(panel_container))); |
| 216 } | 213 } |
| 217 | 214 |
| 218 void RootWindowController::CreateStatusArea() { | |
| 219 WmWindowMus* status_container = | |
| 220 GetWindowByShellWindowId(kShellWindowId_StatusContainer); | |
| 221 // Owned by native widget. | |
| 222 StatusAreaWidget* status_area_widget = | |
| 223 new StatusAreaWidget(status_container, wm_shelf_.get()); | |
| 224 status_area_widget->CreateTrayViews(); | |
| 225 // TODO(jamescook): Remove this when ash::StatusAreaLayoutManager and | |
| 226 // ash::ShelfLayoutManager are working in mash. http://crbug.com/621112 | |
| 227 gfx::Size display_size = display_.bounds().size(); | |
| 228 status_area_widget->SetBounds(gfx::Rect(display_size.width() - 179, | |
| 229 display_size.height() - 48, 120, 40)); | |
| 230 if (WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()) | |
| 231 status_area_widget->Show(); | |
| 232 } | |
| 233 | |
| 234 } // namespace mus | 215 } // namespace mus |
| 235 } // namespace ash | 216 } // namespace ash |
| OLD | NEW |