| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/window_manager.h" | 5 #include "ash/mus/window_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "ash/common/session/session_controller.h" | 11 #include "ash/common/session/session_controller.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/wm/container_finder.h" | 13 #include "ash/common/wm/container_finder.h" |
| 14 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
| 15 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
| 16 #include "ash/mus/accelerators/accelerator_handler.h" | 16 #include "ash/mus/accelerators/accelerator_handler.h" |
| 17 #include "ash/mus/accelerators/accelerator_ids.h" | 17 #include "ash/mus/accelerators/accelerator_ids.h" |
| 18 #include "ash/mus/bridge/wm_lookup_mus.h" | 18 #include "ash/mus/bridge/wm_lookup_mus.h" |
| 19 #include "ash/mus/bridge/wm_shell_mus.h" | 19 #include "ash/mus/bridge/wm_shell_mus.h" |
| 20 #include "ash/mus/move_event_handler.h" | 20 #include "ash/mus/move_event_handler.h" |
| 21 #include "ash/mus/non_client_frame_controller.h" | 21 #include "ash/mus/non_client_frame_controller.h" |
| 22 #include "ash/mus/property_util.h" | 22 #include "ash/mus/property_util.h" |
| 23 #include "ash/mus/root_window_controller.h" | |
| 24 #include "ash/mus/screen_mus.h" | 23 #include "ash/mus/screen_mus.h" |
| 25 #include "ash/mus/shadow_controller.h" | 24 #include "ash/mus/shadow_controller.h" |
| 26 #include "ash/mus/shell_delegate_mus.h" | 25 #include "ash/mus/shell_delegate_mus.h" |
| 26 #include "ash/mus/top_level_window_factory.h" |
| 27 #include "ash/mus/window_properties.h" | 27 #include "ash/mus/window_properties.h" |
| 28 #include "ash/public/cpp/shell_window_ids.h" | 28 #include "ash/public/cpp/shell_window_ids.h" |
| 29 #include "ash/root_window_controller.h" | 29 #include "ash/root_window_controller.h" |
| 30 #include "ash/root_window_settings.h" |
| 30 #include "ash/shell.h" | 31 #include "ash/shell.h" |
| 31 #include "ash/shell_init_params.h" | 32 #include "ash/shell_init_params.h" |
| 32 #include "ash/wm/ash_focus_rules.h" | 33 #include "ash/wm/ash_focus_rules.h" |
| 33 #include "ash/wm/window_properties.h" | 34 #include "ash/wm/window_properties.h" |
| 34 #include "base/memory/ptr_util.h" | 35 #include "base/memory/ptr_util.h" |
| 35 #include "services/service_manager/public/cpp/connector.h" | 36 #include "services/service_manager/public/cpp/connector.h" |
| 36 #include "services/ui/common/accelerator_util.h" | 37 #include "services/ui/common/accelerator_util.h" |
| 37 #include "services/ui/common/types.h" | 38 #include "services/ui/common/types.h" |
| 38 #include "services/ui/public/cpp/property_type_converters.h" | 39 #include "services/ui/public/cpp/property_type_converters.h" |
| 39 #include "services/ui/public/interfaces/constants.mojom.h" | 40 #include "services/ui/public/interfaces/constants.mojom.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 DCHECK(!window_tree_client_); | 86 DCHECK(!window_tree_client_); |
| 86 window_tree_client_ = std::move(window_tree_client); | 87 window_tree_client_ = std::move(window_tree_client); |
| 87 | 88 |
| 88 DCHECK_EQ(nullptr, ash::Shell::window_tree_client()); | 89 DCHECK_EQ(nullptr, ash::Shell::window_tree_client()); |
| 89 ash::Shell::set_window_tree_client(window_tree_client_.get()); | 90 ash::Shell::set_window_tree_client(window_tree_client_.get()); |
| 90 | 91 |
| 91 // |connector_| will be null in some tests. | 92 // |connector_| will be null in some tests. |
| 92 if (connector_) | 93 if (connector_) |
| 93 connector_->BindInterface(ui::mojom::kServiceName, &display_controller_); | 94 connector_->BindInterface(ui::mojom::kServiceName, &display_controller_); |
| 94 | 95 |
| 95 screen_ = base::MakeUnique<ScreenMus>(); | 96 screen_ = base::MakeUnique<ScreenMus>(display_controller_.get()); |
| 96 display::Screen::SetScreenInstance(screen_.get()); | 97 display::Screen::SetScreenInstance(screen_.get()); |
| 97 | 98 |
| 98 pointer_watcher_event_router_ = | 99 pointer_watcher_event_router_ = |
| 99 base::MakeUnique<views::PointerWatcherEventRouter>( | 100 base::MakeUnique<views::PointerWatcherEventRouter>( |
| 100 window_tree_client_.get()); | 101 window_tree_client_.get()); |
| 101 | 102 |
| 102 shadow_controller_ = base::MakeUnique<ShadowController>(); | 103 shadow_controller_ = base::MakeUnique<ShadowController>(); |
| 103 | 104 |
| 104 ui::mojom::FrameDecorationValuesPtr frame_decoration_values = | 105 ui::mojom::FrameDecorationValuesPtr frame_decoration_values = |
| 105 ui::mojom::FrameDecorationValues::New(); | 106 ui::mojom::FrameDecorationValues::New(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 129 const bool in_shutdown = true; | 130 const bool in_shutdown = true; |
| 130 for (RootWindowController* root_window_controller : | 131 for (RootWindowController* root_window_controller : |
| 131 secondary_root_window_controllers) { | 132 secondary_root_window_controllers) { |
| 132 DestroyRootWindowController(root_window_controller, in_shutdown); | 133 DestroyRootWindowController(root_window_controller, in_shutdown); |
| 133 } | 134 } |
| 134 if (primary_root_window_controller) | 135 if (primary_root_window_controller) |
| 135 DestroyRootWindowController(primary_root_window_controller, in_shutdown); | 136 DestroyRootWindowController(primary_root_window_controller, in_shutdown); |
| 136 DCHECK(root_window_controllers_.empty()); | 137 DCHECK(root_window_controllers_.empty()); |
| 137 } | 138 } |
| 138 | 139 |
| 139 aura::Window* WindowManager::NewTopLevelWindow( | |
| 140 ui::mojom::WindowType window_type, | |
| 141 std::map<std::string, std::vector<uint8_t>>* properties) { | |
| 142 RootWindowController* root_window_controller = | |
| 143 GetRootWindowControllerForNewTopLevelWindow(properties); | |
| 144 aura::Window* window = | |
| 145 root_window_controller->NewTopLevelWindow(window_type, properties); | |
| 146 if (properties->count( | |
| 147 ui::mojom::WindowManager::kWindowIgnoredByShelf_Property)) { | |
| 148 wm::WindowState* window_state = WmWindow::Get(window)->GetWindowState(); | |
| 149 window_state->set_ignored_by_shelf(mojo::ConvertTo<bool>( | |
| 150 (*properties) | |
| 151 [ui::mojom::WindowManager::kWindowIgnoredByShelf_Property])); | |
| 152 // No need to persist this value. | |
| 153 properties->erase(ui::mojom::WindowManager::kWindowIgnoredByShelf_Property); | |
| 154 } | |
| 155 return window; | |
| 156 } | |
| 157 | |
| 158 std::set<RootWindowController*> WindowManager::GetRootWindowControllers() { | 140 std::set<RootWindowController*> WindowManager::GetRootWindowControllers() { |
| 159 std::set<RootWindowController*> result; | 141 std::set<RootWindowController*> result; |
| 160 for (auto& root_window_controller : root_window_controllers_) | 142 for (auto& root_window_controller : root_window_controllers_) |
| 161 result.insert(root_window_controller.get()); | 143 result.insert(root_window_controller.get()); |
| 162 return result; | 144 return result; |
| 163 } | 145 } |
| 164 | 146 |
| 165 bool WindowManager::GetNextAcceleratorNamespaceId(uint16_t* id) { | 147 bool WindowManager::GetNextAcceleratorNamespaceId(uint16_t* id) { |
| 166 if (accelerator_handlers_.size() == std::numeric_limits<uint16_t>::max()) | 148 if (accelerator_handlers_.size() == std::numeric_limits<uint16_t>::max()) |
| 167 return false; | 149 return false; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 183 } | 165 } |
| 184 | 166 |
| 185 display::mojom::DisplayController* WindowManager::GetDisplayController() { | 167 display::mojom::DisplayController* WindowManager::GetDisplayController() { |
| 186 return display_controller_ ? display_controller_.get() : nullptr; | 168 return display_controller_ ? display_controller_.get() : nullptr; |
| 187 } | 169 } |
| 188 | 170 |
| 189 void WindowManager::CreatePrimaryRootWindowController( | 171 void WindowManager::CreatePrimaryRootWindowController( |
| 190 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 172 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 191 // See comment in CreateRootWindowController(). | 173 // See comment in CreateRootWindowController(). |
| 192 DCHECK(created_shell_); | 174 DCHECK(created_shell_); |
| 193 std::unique_ptr<RootWindowController> root_window_controller_ptr( | 175 CreateAndRegisterRootWindowController( |
| 194 new RootWindowController( | 176 std::move(window_tree_host), screen_->GetAllDisplays()[0], |
| 195 this, std::move(window_tree_host), screen_->GetAllDisplays()[0], | 177 RootWindowController::RootWindowType::PRIMARY); |
| 196 ash::RootWindowController::RootWindowType::PRIMARY)); | |
| 197 root_window_controllers_.insert(std::move(root_window_controller_ptr)); | |
| 198 } | 178 } |
| 199 | 179 |
| 200 void WindowManager::CreateShell( | 180 void WindowManager::CreateShell( |
| 201 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 181 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 202 DCHECK(!created_shell_); | 182 DCHECK(!created_shell_); |
| 203 created_shell_ = true; | 183 created_shell_ = true; |
| 204 ShellInitParams init_params; | 184 ShellInitParams init_params; |
| 205 WmShellMus* wm_shell = | 185 WmShellMus* wm_shell = |
| 206 new WmShellMus(WmWindow::Get(window_tree_host->window()), | 186 new WmShellMus(WmWindow::Get(window_tree_host->window()), |
| 207 base::MakeUnique<ShellDelegateMus>( | 187 base::MakeUnique<ShellDelegateMus>( |
| 208 connector_, std::move(system_tray_delegate_for_test_)), | 188 connector_, std::move(system_tray_delegate_for_test_)), |
| 209 this, pointer_watcher_event_router_.get()); | 189 this, pointer_watcher_event_router_.get()); |
| 210 init_params.primary_window_tree_host = window_tree_host.release(); | 190 init_params.primary_window_tree_host = window_tree_host.release(); |
| 211 init_params.wm_shell = wm_shell; | 191 init_params.wm_shell = wm_shell; |
| 212 init_params.blocking_pool = blocking_pool_.get(); | 192 init_params.blocking_pool = blocking_pool_.get(); |
| 213 Shell::CreateInstance(init_params); | 193 Shell::CreateInstance(init_params); |
| 214 } | 194 } |
| 215 | 195 |
| 216 void WindowManager::CreateRootWindowController( | 196 void WindowManager::CreateAndRegisterRootWindowController( |
| 217 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 197 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 218 const display::Display& display, | 198 const display::Display& display, |
| 219 ash::RootWindowController::RootWindowType root_window_type) { | 199 RootWindowController::RootWindowType root_window_type) { |
| 220 // The ash startup sequence creates the Shell, which creates | 200 RootWindowSettings* root_window_settings = |
| 221 // WindowTreeHostManager, which creates the WindowTreeHosts and | 201 InitRootWindowSettings(window_tree_host->window()); |
| 222 // RootWindowControllers. For mash we are supplied the WindowTreeHost when | 202 root_window_settings->display_id = display.id(); |
| 223 // a display is added (and WindowTreeHostManager is not used in mash). Mash | 203 std::unique_ptr<RootWindowController> root_window_controller( |
| 224 // waits for the first WindowTreeHost, then creates the shell. As there are | 204 new RootWindowController(nullptr, window_tree_host.release())); |
| 225 // order dependencies we have to create the RootWindowController at a similar | 205 root_window_controller->Init(root_window_type); |
| 226 // time as cash, to do that we inject the WindowTreeHost into ShellInitParams. | 206 // TODO: To avoid lots of IPC AddActivationParent() should take an array. |
| 227 // Shell calls to WmShell::InitHosts(), which calls back to | 207 // http://crbug.com/682048. |
| 228 // CreatePrimaryRootWindowController(). | 208 WmWindow* root_window = root_window_controller->GetWindow(); |
| 229 if (!created_shell_) { | 209 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { |
| 230 CreateShell(std::move(window_tree_host)); | 210 window_manager_client_->AddActivationParent( |
| 231 return; | 211 root_window->GetChildByShellWindowId(kActivatableShellWindowIds[i]) |
| 212 ->aura_window()); |
| 232 } | 213 } |
| 233 std::unique_ptr<RootWindowController> root_window_controller_ptr( | 214 root_window_controllers_.insert(std::move(root_window_controller)); |
| 234 new RootWindowController( | |
| 235 this, std::move(window_tree_host), display, | |
| 236 ash::RootWindowController::RootWindowType::SECONDARY)); | |
| 237 root_window_controllers_.insert(std::move(root_window_controller_ptr)); | |
| 238 | |
| 239 for (auto& observer : *screen_->display_list().observers()) | |
| 240 observer.OnDisplayAdded(display); | |
| 241 } | 215 } |
| 242 | 216 |
| 243 void WindowManager::DestroyRootWindowController( | 217 void WindowManager::DestroyRootWindowController( |
| 244 RootWindowController* root_window_controller, | 218 RootWindowController* root_window_controller, |
| 245 bool in_shutdown) { | 219 bool in_shutdown) { |
| 246 if (!in_shutdown && root_window_controllers_.size() > 1) { | 220 if (!in_shutdown && root_window_controllers_.size() > 1) { |
| 247 DCHECK_NE(root_window_controller, GetPrimaryRootWindowController()); | 221 DCHECK_NE(root_window_controller, GetPrimaryRootWindowController()); |
| 248 root_window_controller->ash_root_window_controller()->MoveWindowsTo( | 222 root_window_controller->MoveWindowsTo( |
| 249 GetPrimaryRootWindowController()->root()); | 223 GetPrimaryRootWindowController()->GetRootWindow()); |
| 250 } | 224 } |
| 251 | 225 |
| 252 root_window_controller->Shutdown(); | 226 root_window_controller->Shutdown(); |
| 253 | 227 |
| 254 for (auto iter = root_window_controllers_.begin(); | 228 for (auto iter = root_window_controllers_.begin(); |
| 255 iter != root_window_controllers_.end(); ++iter) { | 229 iter != root_window_controllers_.end(); ++iter) { |
| 256 if (iter->get() == root_window_controller) { | 230 if (iter->get() == root_window_controller) { |
| 257 root_window_controllers_.erase(iter); | 231 root_window_controllers_.erase(iter); |
| 258 break; | 232 break; |
| 259 } | 233 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 275 window_manager_client_ = nullptr; | 249 window_manager_client_ = nullptr; |
| 276 } | 250 } |
| 277 | 251 |
| 278 RootWindowController* WindowManager::GetPrimaryRootWindowController() { | 252 RootWindowController* WindowManager::GetPrimaryRootWindowController() { |
| 279 return RootWindowController::ForWindow(WmShell::Get() | 253 return RootWindowController::ForWindow(WmShell::Get() |
| 280 ->GetPrimaryRootWindowController() | 254 ->GetPrimaryRootWindowController() |
| 281 ->GetWindow() | 255 ->GetWindow() |
| 282 ->aura_window()); | 256 ->aura_window()); |
| 283 } | 257 } |
| 284 | 258 |
| 285 RootWindowController* | |
| 286 WindowManager::GetRootWindowControllerForNewTopLevelWindow( | |
| 287 std::map<std::string, std::vector<uint8_t>>* properties) { | |
| 288 // If a specific display was requested, use it. | |
| 289 const int64_t display_id = GetInitialDisplayId(*properties); | |
| 290 for (auto& root_window_controller_ptr : root_window_controllers_) { | |
| 291 if (root_window_controller_ptr->display().id() == display_id) | |
| 292 return root_window_controller_ptr.get(); | |
| 293 } | |
| 294 | |
| 295 return RootWindowController::ForWindow( | |
| 296 WmShellMus::Get()->GetRootWindowForNewWindows()->aura_window()); | |
| 297 } | |
| 298 | |
| 299 void WindowManager::OnEmbed( | 259 void WindowManager::OnEmbed( |
| 300 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 260 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 301 // WindowManager should never see this, instead OnWmNewDisplay() is called. | 261 // WindowManager should never see this, instead OnWmNewDisplay() is called. |
| 302 NOTREACHED(); | 262 NOTREACHED(); |
| 303 } | 263 } |
| 304 | 264 |
| 305 void WindowManager::OnEmbedRootDestroyed( | 265 void WindowManager::OnEmbedRootDestroyed( |
| 306 aura::WindowTreeHostMus* window_tree_host) { | 266 aura::WindowTreeHostMus* window_tree_host) { |
| 307 // WindowManager should never see this. | 267 // WindowManager should never see this. |
| 308 NOTREACHED(); | 268 NOTREACHED(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } | 322 } |
| 363 | 323 |
| 364 aura::Window* WindowManager::OnWmCreateTopLevelWindow( | 324 aura::Window* WindowManager::OnWmCreateTopLevelWindow( |
| 365 ui::mojom::WindowType window_type, | 325 ui::mojom::WindowType window_type, |
| 366 std::map<std::string, std::vector<uint8_t>>* properties) { | 326 std::map<std::string, std::vector<uint8_t>>* properties) { |
| 367 if (window_type == ui::mojom::WindowType::UNKNOWN) { | 327 if (window_type == ui::mojom::WindowType::UNKNOWN) { |
| 368 LOG(WARNING) << "Request to create top level of unknown type, failing"; | 328 LOG(WARNING) << "Request to create top level of unknown type, failing"; |
| 369 return nullptr; | 329 return nullptr; |
| 370 } | 330 } |
| 371 | 331 |
| 372 return NewTopLevelWindow(window_type, properties); | 332 return CreateAndParentTopLevelWindow(this, window_type, properties); |
| 373 } | 333 } |
| 374 | 334 |
| 375 void WindowManager::OnWmClientJankinessChanged( | 335 void WindowManager::OnWmClientJankinessChanged( |
| 376 const std::set<aura::Window*>& client_windows, | 336 const std::set<aura::Window*>& client_windows, |
| 377 bool janky) { | 337 bool janky) { |
| 378 for (auto* window : client_windows) | 338 for (auto* window : client_windows) |
| 379 window->SetProperty(kWindowIsJanky, janky); | 339 window->SetProperty(kWindowIsJanky, janky); |
| 380 } | 340 } |
| 381 | 341 |
| 382 void WindowManager::OnWmWillCreateDisplay(const display::Display& display) { | 342 void WindowManager::OnWmWillCreateDisplay(const display::Display& display) { |
| 383 // A call to this function means a new display is being added, so the | 343 // A call to this function means a new display is being added, so the |
| 384 // DisplayList needs to be updated. Calling AddDisplay() results in | 344 // DisplayList needs to be updated. Calling AddDisplay() results in |
| 385 // notifying DisplayObservers. Ash code assumes when this happens there is | 345 // notifying DisplayObservers. Ash code assumes when this happens there is |
| 386 // a valid RootWindowController for the new display. Suspend notifying | 346 // a valid RootWindowController for the new display. Suspend notifying |
| 387 // observers, add the Display. The RootWindowController is created in | 347 // observers, add the Display. The RootWindowController is created in |
| 388 // OnWmNewDisplay(), which is called immediately after this function. | 348 // OnWmNewDisplay(), which is called immediately after this function. |
| 389 std::unique_ptr<display::DisplayListObserverLock> display_lock = | 349 std::unique_ptr<display::DisplayListObserverLock> display_lock = |
| 390 screen_->display_list().SuspendObserverUpdates(); | 350 screen_->display_list().SuspendObserverUpdates(); |
| 391 const bool is_first_display = screen_->display_list().displays().empty(); | 351 const bool is_first_display = screen_->display_list().displays().empty(); |
| 392 // TODO(sky): should be passed whether display is primary. | 352 // TODO(sky): should be passed whether display is primary. |
| 393 screen_->display_list().AddDisplay( | 353 screen_->display_list().AddDisplay( |
| 394 display, is_first_display ? display::DisplayList::Type::PRIMARY | 354 display, is_first_display ? display::DisplayList::Type::PRIMARY |
| 395 : display::DisplayList::Type::NOT_PRIMARY); | 355 : display::DisplayList::Type::NOT_PRIMARY); |
| 396 } | 356 } |
| 397 | 357 |
| 398 void WindowManager::OnWmNewDisplay( | 358 void WindowManager::OnWmNewDisplay( |
| 399 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 359 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 400 const display::Display& display) { | 360 const display::Display& display) { |
| 401 ash::RootWindowController::RootWindowType root_window_type = | 361 RootWindowController::RootWindowType root_window_type = |
| 402 screen_->display_list().displays().size() == 1 | 362 screen_->display_list().displays().size() == 1 |
| 403 ? ash::RootWindowController::RootWindowType::PRIMARY | 363 ? RootWindowController::RootWindowType::PRIMARY |
| 404 : ash::RootWindowController::RootWindowType::SECONDARY; | 364 : RootWindowController::RootWindowType::SECONDARY; |
| 405 CreateRootWindowController(std::move(window_tree_host), display, | 365 // The ash startup sequence creates the Shell, which creates |
| 406 root_window_type); | 366 // WindowTreeHostManager, which creates the WindowTreeHosts and |
| 367 // RootWindowControllers. For mash we are supplied the WindowTreeHost when |
| 368 // a display is added (and WindowTreeHostManager is not used in mash). Mash |
| 369 // waits for the first WindowTreeHost, then creates the shell. As there are |
| 370 // order dependencies we have to create the RootWindowController at a similar |
| 371 // time as cash, to do that we inject the WindowTreeHost into ShellInitParams. |
| 372 // Shell calls to WmShell::InitHosts(), which calls back to |
| 373 // CreatePrimaryRootWindowController(). |
| 374 if (!created_shell_) { |
| 375 CreateShell(std::move(window_tree_host)); |
| 376 return; |
| 377 } |
| 378 CreateAndRegisterRootWindowController(std::move(window_tree_host), display, |
| 379 root_window_type); |
| 380 |
| 381 for (auto& observer : *screen_->display_list().observers()) |
| 382 observer.OnDisplayAdded(display); |
| 407 } | 383 } |
| 408 | 384 |
| 409 void WindowManager::OnWmDisplayRemoved( | 385 void WindowManager::OnWmDisplayRemoved( |
| 410 aura::WindowTreeHostMus* window_tree_host) { | 386 aura::WindowTreeHostMus* window_tree_host) { |
| 411 for (auto& root_window_controller_ptr : root_window_controllers_) { | 387 for (auto& root_window_controller_ptr : root_window_controllers_) { |
| 412 if (root_window_controller_ptr->window_tree_host() == window_tree_host) { | 388 if (root_window_controller_ptr->GetHost() == window_tree_host) { |
| 413 const bool in_shutdown = false; | 389 const bool in_shutdown = false; |
| 414 DestroyRootWindowController(root_window_controller_ptr.get(), | 390 DestroyRootWindowController(root_window_controller_ptr.get(), |
| 415 in_shutdown); | 391 in_shutdown); |
| 416 break; | 392 break; |
| 417 } | 393 } |
| 418 } | 394 } |
| 419 } | 395 } |
| 420 | 396 |
| 421 void WindowManager::OnWmDisplayModified(const display::Display& display) { | 397 void WindowManager::OnWmDisplayModified(const display::Display& display) { |
| 422 for (auto& controller : root_window_controllers_) { | 398 screen_->display_list().UpdateDisplay(display); |
| 423 if (controller->display().id() == display.id()) { | |
| 424 controller->SetDisplay(display); | |
| 425 // The root window will be resized by the window server. | |
| 426 return; | |
| 427 } | |
| 428 } | |
| 429 | |
| 430 NOTREACHED(); | |
| 431 } | 399 } |
| 432 | 400 |
| 433 void WindowManager::OnWmPerformMoveLoop( | 401 void WindowManager::OnWmPerformMoveLoop( |
| 434 aura::Window* window, | 402 aura::Window* window, |
| 435 ui::mojom::MoveLoopSource source, | 403 ui::mojom::MoveLoopSource source, |
| 436 const gfx::Point& cursor_location, | 404 const gfx::Point& cursor_location, |
| 437 const base::Callback<void(bool)>& on_done) { | 405 const base::Callback<void(bool)>& on_done) { |
| 438 WmWindow* child_window = WmWindow::Get(window); | 406 WmWindow* child_window = WmWindow::Get(window); |
| 439 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window); | 407 MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window); |
| 440 if (!handler) { | 408 if (!handler) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 bool WindowManager::IsWindowActive(aura::Window* window) { | 448 bool WindowManager::IsWindowActive(aura::Window* window) { |
| 481 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; | 449 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; |
| 482 } | 450 } |
| 483 | 451 |
| 484 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { | 452 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { |
| 485 Shell::GetInstance()->activation_client()->DeactivateWindow(window); | 453 Shell::GetInstance()->activation_client()->DeactivateWindow(window); |
| 486 } | 454 } |
| 487 | 455 |
| 488 } // namespace mus | 456 } // namespace mus |
| 489 } // namespace ash | 457 } // namespace ash |
| OLD | NEW |