| 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> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 return window; | 120 return window; |
| 121 } | 121 } |
| 122 | 122 |
| 123 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) { | 123 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) { |
| 124 return WmWindowMus::AsWmWindowMus( | 124 return WmWindowMus::AsWmWindowMus( |
| 125 WmWindowMus::Get(root_)->GetChildByShellWindowId(id)); | 125 WmWindowMus::Get(root_)->GetChildByShellWindowId(id)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) { | 128 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) { |
| 129 gfx::Rect old_work_area = display_.work_area(); |
| 129 display_.UpdateWorkAreaFromInsets(insets); | 130 display_.UpdateWorkAreaFromInsets(insets); |
| 130 display::DisplayList* display_list = | 131 |
| 131 window_manager_->screen()->display_list(); | 132 if (old_work_area == display_.work_area()) |
| 132 auto iter = display_list->FindDisplayById(display_.id()); | 133 return; |
| 133 DCHECK(iter != display_list->displays().end()); | 134 |
| 134 const display::DisplayList::Type display_type = | 135 window_manager_->screen()->display_list()->UpdateDisplay(display_); |
| 135 iter == display_list->GetPrimaryDisplayIterator() | 136 |
| 136 ? display::DisplayList::Type::PRIMARY | 137 // Push new display insets to service:ui if we have a connection. |
| 137 : display::DisplayList::Type::NOT_PRIMARY; | 138 auto* display_controller = window_manager_->GetDisplayController(); |
| 138 display_list->UpdateDisplay(display_, display_type); | 139 if (display_controller) |
| 139 // TODO(kylechar): needs to push to DisplayController. | 140 display_controller->SetDisplayWorkArea(display_.id(), |
| 140 NOTIMPLEMENTED(); | 141 display_.bounds().size(), insets); |
| 142 } |
| 143 |
| 144 void RootWindowController::SetDisplay(const display::Display& display) { |
| 145 DCHECK_EQ(display.id(), display_.id()); |
| 146 display_ = display; |
| 147 window_manager_->screen()->display_list()->UpdateDisplay(display_); |
| 141 } | 148 } |
| 142 | 149 |
| 143 gfx::Rect RootWindowController::CalculateDefaultBounds( | 150 gfx::Rect RootWindowController::CalculateDefaultBounds( |
| 144 ui::Window* window) const { | 151 ui::Window* window) const { |
| 145 if (window->HasSharedProperty( | 152 if (window->HasSharedProperty( |
| 146 ui::mojom::WindowManager::kInitialBounds_Property)) { | 153 ui::mojom::WindowManager::kInitialBounds_Property)) { |
| 147 return window->GetSharedProperty<gfx::Rect>( | 154 return window->GetSharedProperty<gfx::Rect>( |
| 148 ui::mojom::WindowManager::kInitialBounds_Property); | 155 ui::mojom::WindowManager::kInitialBounds_Property); |
| 149 } | 156 } |
| 150 | 157 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 170 void RootWindowController::CreateLayoutManagers() { | 177 void RootWindowController::CreateLayoutManagers() { |
| 171 // Override the default layout managers for certain containers. | 178 // Override the default layout managers for certain containers. |
| 172 WmWindowMus* lock_screen_container = | 179 WmWindowMus* lock_screen_container = |
| 173 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); | 180 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); |
| 174 layout_managers_[lock_screen_container->mus_window()].reset( | 181 layout_managers_[lock_screen_container->mus_window()].reset( |
| 175 new ScreenlockLayout(lock_screen_container->mus_window())); | 182 new ScreenlockLayout(lock_screen_container->mus_window())); |
| 176 } | 183 } |
| 177 | 184 |
| 178 } // namespace mus | 185 } // namespace mus |
| 179 } // namespace ash | 186 } // namespace ash |
| OLD | NEW |