Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: ash/mus/root_window_controller.cc

Issue 2350953009: Centralizes more shared code between ash and mash (Closed)
Patch Set: feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/root_window_controller.h ('k') | ash/mus/test/wm_test_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shelf/shelf_layout_manager.h" 16 #include "ash/common/shelf/shelf_layout_manager.h"
17 #include "ash/common/shell_window_ids.h" 17 #include "ash/common/shell_window_ids.h"
18 #include "ash/common/wm/always_on_top_controller.h"
19 #include "ash/common/wm/container_finder.h" 18 #include "ash/common/wm/container_finder.h"
20 #include "ash/common/wm/dock/docked_window_layout_manager.h" 19 #include "ash/common/wm/dock/docked_window_layout_manager.h"
21 #include "ash/common/wm/panels/panel_layout_manager.h" 20 #include "ash/common/wm/panels/panel_layout_manager.h"
22 #include "ash/common/wm/root_window_layout_manager.h" 21 #include "ash/common/wm/root_window_layout_manager.h"
23 #include "ash/common/wm/workspace/workspace_layout_manager.h" 22 #include "ash/common/wm/workspace/workspace_layout_manager.h"
24 #include "ash/mus/bridge/wm_root_window_controller_mus.h" 23 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
25 #include "ash/mus/bridge/wm_shelf_mus.h" 24 #include "ash/mus/bridge/wm_shelf_mus.h"
26 #include "ash/mus/bridge/wm_shell_mus.h" 25 #include "ash/mus/bridge/wm_shell_mus.h"
27 #include "ash/mus/bridge/wm_window_mus.h" 26 #include "ash/mus/bridge/wm_window_mus.h"
28 #include "ash/mus/container_ids.h" 27 #include "ash/mus/container_ids.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 disconnected_app_handler_.reset(new DisconnectedAppHandler(root)); 64 disconnected_app_handler_.reset(new DisconnectedAppHandler(root));
66 65
67 // Force a layout of the root, and its children, RootWindowLayout handles 66 // Force a layout of the root, and its children, RootWindowLayout handles
68 // both. 67 // both.
69 wm_root_window_controller_->root_window_layout_manager()->OnWindowResized(); 68 wm_root_window_controller_->root_window_layout_manager()->OnWindowResized();
70 69
71 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { 70 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) {
72 window_manager_->window_manager_client()->AddActivationParent( 71 window_manager_->window_manager_client()->AddActivationParent(
73 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window()); 72 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->mus_window());
74 } 73 }
75
76 WmWindowMus* always_on_top_container =
77 GetWindowByShellWindowId(kShellWindowId_AlwaysOnTopContainer);
78 always_on_top_controller_.reset(
79 new AlwaysOnTopController(always_on_top_container));
80 } 74 }
81 75
82 RootWindowController::~RootWindowController() { 76 RootWindowController::~RootWindowController() {
83 wm_root_window_controller_->DeleteWorkspaceController(); 77 Shutdown();
78 root_->Destroy();
79 }
80
81 void RootWindowController::Shutdown() {
82 // NOTE: Shutdown() may be called multiple times.
83 wm_root_window_controller_->ResetRootForNewWindowsIfNecessary();
84 wm_root_window_controller_->CloseChildWindows();
84 } 85 }
85 86
86 shell::Connector* RootWindowController::GetConnector() { 87 shell::Connector* RootWindowController::GetConnector() {
87 return window_manager_->connector(); 88 return window_manager_->connector();
88 } 89 }
89 90
90 ui::Window* RootWindowController::NewTopLevelWindow( 91 ui::Window* RootWindowController::NewTopLevelWindow(
91 std::map<std::string, std::vector<uint8_t>>* properties) { 92 std::map<std::string, std::vector<uint8_t>>* properties) {
92 // TODO(sky): panels need a different frame, http:://crbug.com/614362. 93 // TODO(sky): panels need a different frame, http:://crbug.com/614362.
93 const bool provide_non_client_frame = 94 const bool provide_non_client_frame =
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Creating the shelf also creates the status area and both layout managers. 173 // Creating the shelf also creates the status area and both layout managers.
173 wm_shelf_.reset(new WmShelfMus(wm_root_window_controller_->GetWindow())); 174 wm_shelf_.reset(new WmShelfMus(wm_root_window_controller_->GetWindow()));
174 175
175 WmWindowMus* default_container = 176 WmWindowMus* default_container =
176 GetWindowByShellWindowId(kShellWindowId_DefaultContainer); 177 GetWindowByShellWindowId(kShellWindowId_DefaultContainer);
177 // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's a 178 // WorkspaceLayoutManager is not a mash::wm::LayoutManager (it's a
178 // wm::LayoutManager), so it can't be in |layout_managers_|. 179 // wm::LayoutManager), so it can't be in |layout_managers_|.
179 workspace_layout_manager_ = new WorkspaceLayoutManager(default_container); 180 workspace_layout_manager_ = new WorkspaceLayoutManager(default_container);
180 default_container->SetLayoutManager( 181 default_container->SetLayoutManager(
181 base::WrapUnique(workspace_layout_manager_)); 182 base::WrapUnique(workspace_layout_manager_));
182
183 WmWindowMus* docked_container =
184 GetWindowByShellWindowId(kShellWindowId_DockedContainer);
185 std::unique_ptr<DockedWindowLayoutManager> docked_window_layout_manager =
186 base::MakeUnique<DockedWindowLayoutManager>(docked_container);
187 docked_window_layout_manager->SetShelf(wm_shelf_.get());
188 docked_window_layout_manager->AddObserver(wm_shelf_->shelf_layout_manager());
189 docked_container->SetLayoutManager(std::move(docked_window_layout_manager));
190
191 WmWindowMus* panel_container =
192 GetWindowByShellWindowId(kShellWindowId_PanelContainer);
193 std::unique_ptr<PanelLayoutManager> panel_layout_manager =
194 base::MakeUnique<PanelLayoutManager>(panel_container);
195 panel_layout_manager->SetShelf(wm_shelf_.get());
196 panel_container->SetLayoutManager(std::move(panel_layout_manager));
197 } 183 }
198 184
199 } // namespace mus 185 } // namespace mus
200 } // namespace ash 186 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/root_window_controller.h ('k') | ash/mus/test/wm_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698