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

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

Issue 2235493002: mash: Disable ash_sysui; begin removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Connect to chrome on mash session launch; add missing gn dep. Created 4 years, 4 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/shelf_layout_impl.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>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 GetWindowByShellWindowId(MashContainerToAshShellWindowId(container)); 157 GetWindowByShellWindowId(MashContainerToAshShellWindowId(container));
158 DCHECK(wm_window); 158 DCHECK(wm_window);
159 return wm_window->mus_window(); 159 return wm_window->mus_window();
160 } 160 }
161 161
162 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) { 162 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) {
163 return WmWindowMus::AsWmWindowMus( 163 return WmWindowMus::AsWmWindowMus(
164 WmWindowMus::Get(root_)->GetChildByShellWindowId(id)); 164 WmWindowMus::Get(root_)->GetChildByShellWindowId(id));
165 } 165 }
166 166
167 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
168 return static_cast<ShelfLayoutManager*>(
169 layout_managers_[GetWindowForContainer(Container::USER_PRIVATE_SHELF)]
170 .get());
171 }
172
173 StatusLayoutManager* RootWindowController::GetStatusLayoutManager() {
174 return static_cast<StatusLayoutManager*>(
175 layout_managers_[GetWindowForContainer(Container::STATUS)].get());
176 }
177
178 gfx::Rect RootWindowController::CalculateDefaultBounds( 167 gfx::Rect RootWindowController::CalculateDefaultBounds(
179 ui::Window* window) const { 168 ui::Window* window) const {
180 if (window->HasSharedProperty( 169 if (window->HasSharedProperty(
181 ui::mojom::WindowManager::kInitialBounds_Property)) { 170 ui::mojom::WindowManager::kInitialBounds_Property)) {
182 return window->GetSharedProperty<gfx::Rect>( 171 return window->GetSharedProperty<gfx::Rect>(
183 ui::mojom::WindowManager::kInitialBounds_Property); 172 ui::mojom::WindowManager::kInitialBounds_Property);
184 } 173 }
185 174
186 if (GetWindowShowState(window) == ui::mojom::ShowState::FULLSCREEN) { 175 if (GetWindowShowState(window) == ui::mojom::ShowState::FULLSCREEN) {
187 return gfx::Rect(0, 0, root_->bounds().width(), root_->bounds().height()); 176 return gfx::Rect(0, 0, root_->bounds().width(), root_->bounds().height());
(...skipping 11 matching lines...) Expand all
199 height = std::max(0, std::min(max_size.height(), pref.height())); 188 height = std::max(0, std::min(max_size.height(), pref.height()));
200 } 189 }
201 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40, 190 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40,
202 width, height); 191 width, height);
203 } 192 }
204 193
205 void RootWindowController::OnShelfWindowAvailable() { 194 void RootWindowController::OnShelfWindowAvailable() {
206 DockedWindowLayoutManager* docked_window_layout_manager = 195 DockedWindowLayoutManager* docked_window_layout_manager =
207 DockedWindowLayoutManager::Get(WmWindowMus::Get(root_)); 196 DockedWindowLayoutManager::Get(WmWindowMus::Get(root_));
208 197
209 // Following code expects the shelf to be called only once. 198 DCHECK(!docked_window_layout_manager->shelf());
210 // TODO(sky): this check is only necessary while we have shelf hosted in
211 // sysui (as sysui can restart). Once that is fixed there should be a DCHECK
212 // that the shelf hasn't been set.
213 if (docked_window_layout_manager->shelf())
214 return;
215
216 docked_window_layout_manager->SetShelf(wm_shelf_.get()); 199 docked_window_layout_manager->SetShelf(wm_shelf_.get());
217 200
218 PanelLayoutManager::Get(WmWindowMus::Get(root_))->SetShelf(wm_shelf_.get()); 201 PanelLayoutManager::Get(WmWindowMus::Get(root_))->SetShelf(wm_shelf_.get());
219 202
220 // TODO: http://crbug.com/614182 Ash's ShelfLayoutManager implements 203 // TODO: http://crbug.com/614182 Ash's ShelfLayoutManager implements
221 // DockedWindowLayoutManagerObserver so that it can inset by the docked 204 // DockedWindowLayoutManagerObserver so that it can inset by the docked
222 // windows. 205 // windows.
223 // docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager()); 206 // docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager());
224 } 207 }
225 208
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 base::WrapUnique(new DockedWindowLayoutManager(docked_container))); 244 base::WrapUnique(new DockedWindowLayoutManager(docked_container)));
262 245
263 WmWindowMus* panel_container = 246 WmWindowMus* panel_container =
264 GetWindowByShellWindowId(kShellWindowId_PanelContainer); 247 GetWindowByShellWindowId(kShellWindowId_PanelContainer);
265 panel_container->SetLayoutManager( 248 panel_container->SetLayoutManager(
266 base::WrapUnique(new PanelLayoutManager(panel_container))); 249 base::WrapUnique(new PanelLayoutManager(panel_container)));
267 } 250 }
268 251
269 } // namespace mus 252 } // namespace mus
270 } // namespace ash 253 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/root_window_controller.h ('k') | ash/mus/shelf_layout_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698