| 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 "mash/wm/root_window_controller.h" | 5 #include "mash/wm/root_window_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 void RootWindowController::OnWindowDestroyed(mus::Window* window) { | 212 void RootWindowController::OnWindowDestroyed(mus::Window* window) { |
| 213 DCHECK_EQ(window, root_); | 213 DCHECK_EQ(window, root_); |
| 214 app_->OnRootWindowDestroyed(this); | 214 app_->OnRootWindowDestroyed(this); |
| 215 root_->RemoveObserver(this); | 215 root_->RemoveObserver(this); |
| 216 // Delete the |window_manager_| here so that WindowManager doesn't have to | 216 // Delete the |window_manager_| here so that WindowManager doesn't have to |
| 217 // worry about the possibility of |root_| being null. | 217 // worry about the possibility of |root_| being null. |
| 218 window_manager_.reset(); | 218 window_manager_.reset(); |
| 219 root_ = nullptr; | 219 root_ = nullptr; |
| 220 } | 220 } |
| 221 | 221 |
| 222 void RootWindowController::OnShelfWindowAvailable() { |
| 223 ash::DockedWindowLayoutManager::Get(WmWindowMus::Get(root_)) |
| 224 ->SetShelf(wm_shelf_.get()); |
| 225 |
| 226 ash::PanelLayoutManager::Get(WmWindowMus::Get(root_)) |
| 227 ->SetShelf(wm_shelf_.get()); |
| 228 |
| 229 // TODO: http://crbug.com/614182 Ash's ShelfLayoutManager implements |
| 230 // DockedWindowLayoutManagerObserver so that it can inset by the docked |
| 231 // windows. |
| 232 // docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager()); |
| 233 } |
| 234 |
| 222 void RootWindowController::CreateContainer( | 235 void RootWindowController::CreateContainer( |
| 223 mash::wm::mojom::Container container, | 236 mash::wm::mojom::Container container, |
| 224 mash::wm::mojom::Container parent_container) { | 237 mash::wm::mojom::Container parent_container) { |
| 225 // Set the window's name to the container name (e.g. "Container::LOGIN"), | 238 // Set the window's name to the container name (e.g. "Container::LOGIN"), |
| 226 // which makes the window hierarchy easier to read. | 239 // which makes the window hierarchy easier to read. |
| 227 std::map<std::string, std::vector<uint8_t>> properties; | 240 std::map<std::string, std::vector<uint8_t>> properties; |
| 228 std::ostringstream container_name; | 241 std::ostringstream container_name; |
| 229 container_name << container; | 242 container_name << container; |
| 230 properties[mus::mojom::WindowManager::kName_Property] = | 243 properties[mus::mojom::WindowManager::kName_Property] = |
| 231 mojo::ConvertTo<std::vector<uint8_t>>(container_name.str()); | 244 mojo::ConvertTo<std::vector<uint8_t>>(container_name.str()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 mus::Window* user_background = | 299 mus::Window* user_background = |
| 287 GetWindowForContainer(mojom::Container::USER_BACKGROUND); | 300 GetWindowForContainer(mojom::Container::USER_BACKGROUND); |
| 288 layout_managers_[user_background].reset( | 301 layout_managers_[user_background].reset( |
| 289 new BackgroundLayout(user_background)); | 302 new BackgroundLayout(user_background)); |
| 290 | 303 |
| 291 mus::Window* login_app = GetWindowForContainer(mojom::Container::LOGIN_APP); | 304 mus::Window* login_app = GetWindowForContainer(mojom::Container::LOGIN_APP); |
| 292 layout_managers_[login_app].reset(new ScreenlockLayout(login_app)); | 305 layout_managers_[login_app].reset(new ScreenlockLayout(login_app)); |
| 293 | 306 |
| 294 mus::Window* user_shelf = | 307 mus::Window* user_shelf = |
| 295 GetWindowForContainer(mojom::Container::USER_PRIVATE_SHELF); | 308 GetWindowForContainer(mojom::Container::USER_PRIVATE_SHELF); |
| 296 ShelfLayoutManager* shelf_layout_manager = new ShelfLayoutManager(user_shelf); | 309 ShelfLayoutManager* shelf_layout_manager = |
| 310 new ShelfLayoutManager(user_shelf, this); |
| 297 layout_managers_[user_shelf].reset(shelf_layout_manager); | 311 layout_managers_[user_shelf].reset(shelf_layout_manager); |
| 298 | 312 |
| 299 wm_shelf_.reset(new WmShelfMus(shelf_layout_manager)); | 313 wm_shelf_.reset(new WmShelfMus(shelf_layout_manager)); |
| 300 | 314 |
| 301 mus::Window* status = GetWindowForContainer(mojom::Container::STATUS); | 315 mus::Window* status = GetWindowForContainer(mojom::Container::STATUS); |
| 302 layout_managers_[status].reset(new StatusLayoutManager(status)); | 316 layout_managers_[status].reset(new StatusLayoutManager(status)); |
| 303 | 317 |
| 304 mus::Window* user_private_windows = | 318 mus::Window* user_private_windows = |
| 305 GetWindowForContainer(mojom::Container::USER_PRIVATE_WINDOWS); | 319 GetWindowForContainer(mojom::Container::USER_PRIVATE_WINDOWS); |
| 306 // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's an | 320 // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's an |
| (...skipping 18 matching lines...) Expand all Loading... |
| 325 mus::Window* user_private_panels = | 339 mus::Window* user_private_panels = |
| 326 GetWindowForContainer(mojom::Container::USER_PRIVATE_PANELS); | 340 GetWindowForContainer(mojom::Container::USER_PRIVATE_PANELS); |
| 327 WmWindowMus* user_private_panels_wm = WmWindowMus::Get(user_private_panels); | 341 WmWindowMus* user_private_panels_wm = WmWindowMus::Get(user_private_panels); |
| 328 layout_managers_.erase(user_private_panels); | 342 layout_managers_.erase(user_private_panels); |
| 329 user_private_panels_wm->SetLayoutManager( | 343 user_private_panels_wm->SetLayoutManager( |
| 330 base::WrapUnique(new ash::PanelLayoutManager(user_private_panels_wm))); | 344 base::WrapUnique(new ash::PanelLayoutManager(user_private_panels_wm))); |
| 331 } | 345 } |
| 332 | 346 |
| 333 } // namespace wm | 347 } // namespace wm |
| 334 } // namespace mash | 348 } // namespace mash |
| OLD | NEW |