| 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/drag_drop/drag_image_view.h" | 11 #include "ash/drag_drop/drag_image_view.h" |
| 12 #include "ash/mus/accelerators/accelerator_handler.h" | 12 #include "ash/mus/accelerators/accelerator_handler.h" |
| 13 #include "ash/mus/accelerators/accelerator_ids.h" | 13 #include "ash/mus/accelerators/accelerator_ids.h" |
| 14 #include "ash/mus/bridge/wm_shell_mus.h" | 14 #include "ash/mus/bridge/shell_port_mash.h" |
| 15 #include "ash/mus/move_event_handler.h" | 15 #include "ash/mus/move_event_handler.h" |
| 16 #include "ash/mus/non_client_frame_controller.h" | 16 #include "ash/mus/non_client_frame_controller.h" |
| 17 #include "ash/mus/property_util.h" | 17 #include "ash/mus/property_util.h" |
| 18 #include "ash/mus/screen_mus.h" | 18 #include "ash/mus/screen_mus.h" |
| 19 #include "ash/mus/shell_delegate_mus.h" | 19 #include "ash/mus/shell_delegate_mus.h" |
| 20 #include "ash/mus/top_level_window_factory.h" | 20 #include "ash/mus/top_level_window_factory.h" |
| 21 #include "ash/mus/window_properties.h" | 21 #include "ash/mus/window_properties.h" |
| 22 #include "ash/public/cpp/config.h" | 22 #include "ash/public/cpp/config.h" |
| 23 #include "ash/public/cpp/shelf_types.h" | 23 #include "ash/public/cpp/shelf_types.h" |
| 24 #include "ash/public/cpp/shell_window_ids.h" | 24 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 CreateAndRegisterRootWindowController( | 213 CreateAndRegisterRootWindowController( |
| 214 std::move(window_tree_host), screen_->GetAllDisplays()[0], | 214 std::move(window_tree_host), screen_->GetAllDisplays()[0], |
| 215 RootWindowController::RootWindowType::PRIMARY); | 215 RootWindowController::RootWindowType::PRIMARY); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void WindowManager::CreateShell( | 218 void WindowManager::CreateShell( |
| 219 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 219 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 220 DCHECK(!created_shell_); | 220 DCHECK(!created_shell_); |
| 221 created_shell_ = true; | 221 created_shell_ = true; |
| 222 ShellInitParams init_params; | 222 ShellInitParams init_params; |
| 223 WmShellMus* wm_shell = new WmShellMus( | 223 ShellPortMash* shell_port = |
| 224 WmWindow::Get(window_tree_host->window()), | 224 new ShellPortMash(WmWindow::Get(window_tree_host->window()), this, |
| 225 this, pointer_watcher_event_router_.get(), | 225 pointer_watcher_event_router_.get(), |
| 226 create_session_state_delegate_stub_for_test_); | 226 create_session_state_delegate_stub_for_test_); |
| 227 // Shell::CreateInstance() takes ownership of ShellDelegate. | 227 // Shell::CreateInstance() takes ownership of ShellDelegate. |
| 228 init_params.delegate = shell_delegate_ ? shell_delegate_.release() | 228 init_params.delegate = shell_delegate_ ? shell_delegate_.release() |
| 229 : new ShellDelegateMus(connector_); | 229 : new ShellDelegateMus(connector_); |
| 230 init_params.primary_window_tree_host = window_tree_host.release(); | 230 init_params.primary_window_tree_host = window_tree_host.release(); |
| 231 init_params.wm_shell = wm_shell; | 231 init_params.shell_port = shell_port; |
| 232 init_params.blocking_pool = blocking_pool_.get(); | 232 init_params.blocking_pool = blocking_pool_.get(); |
| 233 Shell::CreateInstance(init_params); | 233 Shell::CreateInstance(init_params); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void WindowManager::CreateAndRegisterRootWindowController( | 236 void WindowManager::CreateAndRegisterRootWindowController( |
| 237 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 237 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 238 const display::Display& display, | 238 const display::Display& display, |
| 239 RootWindowController::RootWindowType root_window_type) { | 239 RootWindowController::RootWindowType root_window_type) { |
| 240 RootWindowSettings* root_window_settings = | 240 RootWindowSettings* root_window_settings = |
| 241 InitRootWindowSettings(window_tree_host->window()); | 241 InitRootWindowSettings(window_tree_host->window()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 Shell::DeleteInstance(); | 286 Shell::DeleteInstance(); |
| 287 | 287 |
| 288 pointer_watcher_event_router_.reset(); | 288 pointer_watcher_event_router_.reset(); |
| 289 | 289 |
| 290 window_tree_client_.reset(); | 290 window_tree_client_.reset(); |
| 291 window_manager_client_ = nullptr; | 291 window_manager_client_ = nullptr; |
| 292 } | 292 } |
| 293 | 293 |
| 294 RootWindowController* WindowManager::GetPrimaryRootWindowController() { | 294 RootWindowController* WindowManager::GetPrimaryRootWindowController() { |
| 295 return RootWindowController::ForWindow(WmShell::Get() | 295 return RootWindowController::ForWindow(ShellPort::Get() |
| 296 ->GetPrimaryRootWindowController() | 296 ->GetPrimaryRootWindowController() |
| 297 ->GetWindow() | 297 ->GetWindow() |
| 298 ->aura_window()); | 298 ->aura_window()); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void WindowManager::OnEmbed( | 301 void WindowManager::OnEmbed( |
| 302 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 302 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 303 // WindowManager should never see this, instead OnWmNewDisplay() is called. | 303 // WindowManager should never see this, instead OnWmNewDisplay() is called. |
| 304 NOTREACHED(); | 304 NOTREACHED(); |
| 305 } | 305 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 screen_->display_list().displays().size() == 1 | 457 screen_->display_list().displays().size() == 1 |
| 458 ? RootWindowController::RootWindowType::PRIMARY | 458 ? RootWindowController::RootWindowType::PRIMARY |
| 459 : RootWindowController::RootWindowType::SECONDARY; | 459 : RootWindowController::RootWindowType::SECONDARY; |
| 460 // The ash startup sequence creates the Shell, which creates | 460 // The ash startup sequence creates the Shell, which creates |
| 461 // WindowTreeHostManager, which creates the WindowTreeHosts and | 461 // WindowTreeHostManager, which creates the WindowTreeHosts and |
| 462 // RootWindowControllers. For mash we are supplied the WindowTreeHost when | 462 // RootWindowControllers. For mash we are supplied the WindowTreeHost when |
| 463 // a display is added (and WindowTreeHostManager is not used in mash). Mash | 463 // a display is added (and WindowTreeHostManager is not used in mash). Mash |
| 464 // waits for the first WindowTreeHost, then creates the shell. As there are | 464 // waits for the first WindowTreeHost, then creates the shell. As there are |
| 465 // order dependencies we have to create the RootWindowController at a similar | 465 // order dependencies we have to create the RootWindowController at a similar |
| 466 // time as cash, to do that we inject the WindowTreeHost into ShellInitParams. | 466 // time as cash, to do that we inject the WindowTreeHost into ShellInitParams. |
| 467 // Shell calls to WmShell::InitHosts(), which calls back to | 467 // Shell calls to ShellPort::InitHosts(), which calls back to |
| 468 // CreatePrimaryRootWindowController(). | 468 // CreatePrimaryRootWindowController(). |
| 469 if (!created_shell_) { | 469 if (!created_shell_) { |
| 470 CreateShell(std::move(window_tree_host)); | 470 CreateShell(std::move(window_tree_host)); |
| 471 return; | 471 return; |
| 472 } | 472 } |
| 473 CreateAndRegisterRootWindowController(std::move(window_tree_host), display, | 473 CreateAndRegisterRootWindowController(std::move(window_tree_host), display, |
| 474 root_window_type); | 474 root_window_type); |
| 475 | 475 |
| 476 for (auto& observer : *screen_->display_list().observers()) | 476 for (auto& observer : *screen_->display_list().observers()) |
| 477 observer.OnDisplayAdded(display); | 477 observer.OnDisplayAdded(display); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 494 // and finally DisplayObservers. | 494 // and finally DisplayObservers. |
| 495 display::DisplayList& display_list = screen_->display_list(); | 495 display::DisplayList& display_list = screen_->display_list(); |
| 496 std::unique_ptr<display::DisplayListObserverLock> display_lock = | 496 std::unique_ptr<display::DisplayListObserverLock> display_lock = |
| 497 display_list.SuspendObserverUpdates(); | 497 display_list.SuspendObserverUpdates(); |
| 498 const bool is_primary = display_list.FindDisplayById(display.id()) == | 498 const bool is_primary = display_list.FindDisplayById(display.id()) == |
| 499 display_list.GetPrimaryDisplayIterator(); | 499 display_list.GetPrimaryDisplayIterator(); |
| 500 uint32_t display_changed_values = display_list.UpdateDisplay( | 500 uint32_t display_changed_values = display_list.UpdateDisplay( |
| 501 display, is_primary ? display::DisplayList::Type::PRIMARY | 501 display, is_primary ? display::DisplayList::Type::PRIMARY |
| 502 : display::DisplayList::Type::NOT_PRIMARY); | 502 : display::DisplayList::Type::NOT_PRIMARY); |
| 503 RootWindowController* root_window_controller = | 503 RootWindowController* root_window_controller = |
| 504 WmShellMus::Get()->GetRootWindowControllerWithDisplayId(display.id()); | 504 ShellPortMash::Get()->GetRootWindowControllerWithDisplayId(display.id()); |
| 505 DCHECK(root_window_controller); | 505 DCHECK(root_window_controller); |
| 506 root_window_controller->GetRootWindow()->GetHost()->SetBoundsInPixels( | 506 root_window_controller->GetRootWindow()->GetHost()->SetBoundsInPixels( |
| 507 display.bounds()); | 507 display.bounds()); |
| 508 display_lock.reset(); | 508 display_lock.reset(); |
| 509 for (display::DisplayObserver& observer : *(display_list.observers())) | 509 for (display::DisplayObserver& observer : *(display_list.observers())) |
| 510 observer.OnDisplayMetricsChanged(display, display_changed_values); | 510 observer.OnDisplayMetricsChanged(display, display_changed_values); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void WindowManager::OnWmPerformMoveLoop( | 513 void WindowManager::OnWmPerformMoveLoop( |
| 514 aura::Window* window, | 514 aura::Window* window, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 bool WindowManager::IsWindowActive(aura::Window* window) { | 562 bool WindowManager::IsWindowActive(aura::Window* window) { |
| 563 return Shell::Get()->activation_client()->GetActiveWindow() == window; | 563 return Shell::Get()->activation_client()->GetActiveWindow() == window; |
| 564 } | 564 } |
| 565 | 565 |
| 566 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { | 566 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { |
| 567 Shell::Get()->activation_client()->DeactivateWindow(window); | 567 Shell::Get()->activation_client()->DeactivateWindow(window); |
| 568 } | 568 } |
| 569 | 569 |
| 570 } // namespace mus | 570 } // namespace mus |
| 571 } // namespace ash | 571 } // namespace ash |
| OLD | NEW |