| 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 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 lost_connection_callback_ = std::move(closure); | 165 lost_connection_callback_ = std::move(closure); |
| 166 } | 166 } |
| 167 | 167 |
| 168 bool WindowManager::WaitForInitialDisplays() { | 168 bool WindowManager::WaitForInitialDisplays() { |
| 169 return window_manager_client_->WaitForInitialDisplays(); | 169 return window_manager_client_->WaitForInitialDisplays(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void WindowManager::DeleteAllRootWindowControllers() { | 172 void WindowManager::DeleteAllRootWindowControllers() { |
| 173 // Primary RootWindowController must be destroyed last. | 173 // Primary RootWindowController must be destroyed last. |
| 174 RootWindowController* primary_root_window_controller = | 174 RootWindowController* primary_root_window_controller = |
| 175 GetPrimaryRootWindowController(); | 175 Shell::GetPrimaryRootWindowController(); |
| 176 std::set<RootWindowController*> secondary_root_window_controllers; | 176 std::set<RootWindowController*> secondary_root_window_controllers; |
| 177 for (auto& root_window_controller_ptr : root_window_controllers_) { | 177 for (auto& root_window_controller_ptr : root_window_controllers_) { |
| 178 if (root_window_controller_ptr.get() != primary_root_window_controller) { | 178 if (root_window_controller_ptr.get() != primary_root_window_controller) { |
| 179 secondary_root_window_controllers.insert( | 179 secondary_root_window_controllers.insert( |
| 180 root_window_controller_ptr.get()); | 180 root_window_controller_ptr.get()); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 const bool in_shutdown = true; | 183 const bool in_shutdown = true; |
| 184 for (RootWindowController* root_window_controller : | 184 for (RootWindowController* root_window_controller : |
| 185 secondary_root_window_controllers) { | 185 secondary_root_window_controllers) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 CreateAndRegisterRootWindowController( | 228 CreateAndRegisterRootWindowController( |
| 229 std::move(window_tree_host), screen_->GetAllDisplays()[0], | 229 std::move(window_tree_host), screen_->GetAllDisplays()[0], |
| 230 RootWindowController::RootWindowType::PRIMARY); | 230 RootWindowController::RootWindowType::PRIMARY); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void WindowManager::CreateShell( | 233 void WindowManager::CreateShell( |
| 234 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 234 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 235 DCHECK(!created_shell_); | 235 DCHECK(!created_shell_); |
| 236 created_shell_ = true; | 236 created_shell_ = true; |
| 237 ShellInitParams init_params; | 237 ShellInitParams init_params; |
| 238 ShellPortMash* shell_port = new ShellPortMash( | 238 ShellPortMash* shell_port = |
| 239 window_tree_host ? WmWindow::Get(window_tree_host->window()) : nullptr, | 239 new ShellPortMash(window_tree_host ? window_tree_host->window() : nullptr, |
| 240 this, pointer_watcher_event_router_.get(), | 240 this, pointer_watcher_event_router_.get(), |
| 241 create_session_state_delegate_stub_for_test_); | 241 create_session_state_delegate_stub_for_test_); |
| 242 // Shell::CreateInstance() takes ownership of ShellDelegate. | 242 // Shell::CreateInstance() takes ownership of ShellDelegate. |
| 243 init_params.delegate = shell_delegate_ ? shell_delegate_.release() | 243 init_params.delegate = shell_delegate_ ? shell_delegate_.release() |
| 244 : new ShellDelegateMus(connector_); | 244 : new ShellDelegateMus(connector_); |
| 245 init_params.primary_window_tree_host = window_tree_host.release(); | 245 init_params.primary_window_tree_host = window_tree_host.release(); |
| 246 init_params.shell_port = shell_port; | 246 init_params.shell_port = shell_port; |
| 247 init_params.blocking_pool = blocking_pool_.get(); | 247 init_params.blocking_pool = blocking_pool_.get(); |
| 248 Shell::CreateInstance(init_params); | 248 Shell::CreateInstance(init_params); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void WindowManager::CreateAndRegisterRootWindowController( | 251 void WindowManager::CreateAndRegisterRootWindowController( |
| 252 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 252 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 253 const display::Display& display, | 253 const display::Display& display, |
| 254 RootWindowController::RootWindowType root_window_type) { | 254 RootWindowController::RootWindowType root_window_type) { |
| 255 RootWindowSettings* root_window_settings = | 255 RootWindowSettings* root_window_settings = |
| 256 InitRootWindowSettings(window_tree_host->window()); | 256 InitRootWindowSettings(window_tree_host->window()); |
| 257 root_window_settings->display_id = display.id(); | 257 root_window_settings->display_id = display.id(); |
| 258 std::unique_ptr<RootWindowController> root_window_controller( | 258 std::unique_ptr<RootWindowController> root_window_controller( |
| 259 new RootWindowController(nullptr, window_tree_host.release())); | 259 new RootWindowController(nullptr, window_tree_host.release())); |
| 260 root_window_controller->Init(root_window_type); | 260 root_window_controller->Init(root_window_type); |
| 261 root_window_controllers_.insert(std::move(root_window_controller)); | 261 root_window_controllers_.insert(std::move(root_window_controller)); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void WindowManager::DestroyRootWindowController( | 264 void WindowManager::DestroyRootWindowController( |
| 265 RootWindowController* root_window_controller, | 265 RootWindowController* root_window_controller, |
| 266 bool in_shutdown) { | 266 bool in_shutdown) { |
| 267 if (!in_shutdown && root_window_controllers_.size() > 1) { | 267 if (!in_shutdown && root_window_controllers_.size() > 1) { |
| 268 DCHECK_NE(root_window_controller, GetPrimaryRootWindowController()); | 268 DCHECK_NE(root_window_controller, Shell::GetPrimaryRootWindowController()); |
| 269 root_window_controller->MoveWindowsTo( | 269 root_window_controller->MoveWindowsTo(Shell::GetPrimaryRootWindow()); |
| 270 GetPrimaryRootWindowController()->GetRootWindow()); | |
| 271 } | 270 } |
| 272 | 271 |
| 273 root_window_controller->Shutdown(); | 272 root_window_controller->Shutdown(); |
| 274 | 273 |
| 275 for (auto iter = root_window_controllers_.begin(); | 274 for (auto iter = root_window_controllers_.begin(); |
| 276 iter != root_window_controllers_.end(); ++iter) { | 275 iter != root_window_controllers_.end(); ++iter) { |
| 277 if (iter->get() == root_window_controller) { | 276 if (iter->get() == root_window_controller) { |
| 278 root_window_controllers_.erase(iter); | 277 root_window_controllers_.erase(iter); |
| 279 break; | 278 break; |
| 280 } | 279 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 291 capture_client); | 290 capture_client); |
| 292 | 291 |
| 293 Shell::DeleteInstance(); | 292 Shell::DeleteInstance(); |
| 294 | 293 |
| 295 pointer_watcher_event_router_.reset(); | 294 pointer_watcher_event_router_.reset(); |
| 296 | 295 |
| 297 window_tree_client_.reset(); | 296 window_tree_client_.reset(); |
| 298 window_manager_client_ = nullptr; | 297 window_manager_client_ = nullptr; |
| 299 } | 298 } |
| 300 | 299 |
| 301 RootWindowController* WindowManager::GetPrimaryRootWindowController() { | |
| 302 return RootWindowController::ForWindow(ShellPort::Get() | |
| 303 ->GetPrimaryRootWindowController() | |
| 304 ->GetWindow() | |
| 305 ->aura_window()); | |
| 306 } | |
| 307 | |
| 308 void WindowManager::OnEmbed( | 300 void WindowManager::OnEmbed( |
| 309 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 301 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 310 // WindowManager should never see this, instead OnWmNewDisplay() is called. | 302 // WindowManager should never see this, instead OnWmNewDisplay() is called. |
| 311 NOTREACHED(); | 303 NOTREACHED(); |
| 312 } | 304 } |
| 313 | 305 |
| 314 void WindowManager::OnEmbedRootDestroyed( | 306 void WindowManager::OnEmbedRootDestroyed( |
| 315 aura::WindowTreeHostMus* window_tree_host) { | 307 aura::WindowTreeHostMus* window_tree_host) { |
| 316 // WindowManager should never see this. | 308 // WindowManager should never see this. |
| 317 NOTREACHED(); | 309 NOTREACHED(); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 bool WindowManager::IsWindowActive(aura::Window* window) { | 573 bool WindowManager::IsWindowActive(aura::Window* window) { |
| 582 return Shell::Get()->activation_client()->GetActiveWindow() == window; | 574 return Shell::Get()->activation_client()->GetActiveWindow() == window; |
| 583 } | 575 } |
| 584 | 576 |
| 585 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { | 577 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { |
| 586 Shell::Get()->activation_client()->DeactivateWindow(window); | 578 Shell::Get()->activation_client()->DeactivateWindow(window); |
| 587 } | 579 } |
| 588 | 580 |
| 589 } // namespace mus | 581 } // namespace mus |
| 590 } // namespace ash | 582 } // namespace ash |
| OLD | NEW |