| 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 <map> | 9 #include <map> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // TODO(sky): likely want to constrain more than root size. | 190 // TODO(sky): likely want to constrain more than root size. |
| 191 const gfx::Size max_size = root_->bounds().size(); | 191 const gfx::Size max_size = root_->bounds().size(); |
| 192 width = std::max(0, std::min(max_size.width(), pref.width())); | 192 width = std::max(0, std::min(max_size.width(), pref.width())); |
| 193 height = std::max(0, std::min(max_size.height(), pref.height())); | 193 height = std::max(0, std::min(max_size.height(), pref.height())); |
| 194 } | 194 } |
| 195 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40, | 195 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40, |
| 196 width, height); | 196 width, height); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void RootWindowController::OnShelfWindowAvailable() { | 199 void RootWindowController::OnShelfWindowAvailable() { |
| 200 DockedWindowLayoutManager::Get(WmWindowMus::Get(root_)) | 200 DockedWindowLayoutManager* docked_window_layout_manager = |
| 201 ->SetShelf(wm_shelf_.get()); | 201 DockedWindowLayoutManager::Get(WmWindowMus::Get(root_)); |
| 202 |
| 203 // Following code expects the shelf to be called only once. |
| 204 // TODO(sky): this check is only necessary while we have shelf hosted in |
| 205 // sysui (as sysui can restart). Once that is fixed there should be a DCHECK |
| 206 // that the shelf hasn't been set. |
| 207 if (docked_window_layout_manager->shelf()) |
| 208 return; |
| 209 |
| 210 docked_window_layout_manager->SetShelf(wm_shelf_.get()); |
| 202 | 211 |
| 203 PanelLayoutManager::Get(WmWindowMus::Get(root_))->SetShelf(wm_shelf_.get()); | 212 PanelLayoutManager::Get(WmWindowMus::Get(root_))->SetShelf(wm_shelf_.get()); |
| 204 | 213 |
| 205 // TODO: http://crbug.com/614182 Ash's ShelfLayoutManager implements | 214 // TODO: http://crbug.com/614182 Ash's ShelfLayoutManager implements |
| 206 // DockedWindowLayoutManagerObserver so that it can inset by the docked | 215 // DockedWindowLayoutManagerObserver so that it can inset by the docked |
| 207 // windows. | 216 // windows. |
| 208 // docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager()); | 217 // docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager()); |
| 209 } | 218 } |
| 210 | 219 |
| 211 void RootWindowController::CreateLayoutManagers() { | 220 void RootWindowController::CreateLayoutManagers() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 base::WrapUnique(new DockedWindowLayoutManager(docked_container))); | 255 base::WrapUnique(new DockedWindowLayoutManager(docked_container))); |
| 247 | 256 |
| 248 WmWindowMus* panel_container = | 257 WmWindowMus* panel_container = |
| 249 GetWindowByShellWindowId(kShellWindowId_PanelContainer); | 258 GetWindowByShellWindowId(kShellWindowId_PanelContainer); |
| 250 panel_container->SetLayoutManager( | 259 panel_container->SetLayoutManager( |
| 251 base::WrapUnique(new PanelLayoutManager(panel_container))); | 260 base::WrapUnique(new PanelLayoutManager(panel_container))); |
| 252 } | 261 } |
| 253 | 262 |
| 254 } // namespace mus | 263 } // namespace mus |
| 255 } // namespace ash | 264 } // namespace ash |
| OLD | NEW |