| 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/shell_port_mash.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" | |
| 25 #include "ash/public/cpp/window_pin_type.h" | 24 #include "ash/public/cpp/window_pin_type.h" |
| 26 #include "ash/public/cpp/window_properties.h" | 25 #include "ash/public/cpp/window_properties.h" |
| 27 #include "ash/public/interfaces/window_pin_type.mojom.h" | 26 #include "ash/public/interfaces/window_pin_type.mojom.h" |
| 28 #include "ash/root_window_controller.h" | 27 #include "ash/root_window_controller.h" |
| 29 #include "ash/root_window_settings.h" | 28 #include "ash/root_window_settings.h" |
| 30 #include "ash/session/session_controller.h" | 29 #include "ash/session/session_controller.h" |
| 31 #include "ash/shell.h" | 30 #include "ash/shell.h" |
| 32 #include "ash/shell_init_params.h" | 31 #include "ash/shell_init_params.h" |
| 33 #include "ash/wm/ash_focus_rules.h" | 32 #include "ash/wm/ash_focus_rules.h" |
| 34 #include "ash/wm/container_finder.h" | 33 #include "ash/wm/container_finder.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 void WindowManager::CreateAndRegisterRootWindowController( | 241 void WindowManager::CreateAndRegisterRootWindowController( |
| 243 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 242 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 244 const display::Display& display, | 243 const display::Display& display, |
| 245 RootWindowController::RootWindowType root_window_type) { | 244 RootWindowController::RootWindowType root_window_type) { |
| 246 RootWindowSettings* root_window_settings = | 245 RootWindowSettings* root_window_settings = |
| 247 InitRootWindowSettings(window_tree_host->window()); | 246 InitRootWindowSettings(window_tree_host->window()); |
| 248 root_window_settings->display_id = display.id(); | 247 root_window_settings->display_id = display.id(); |
| 249 std::unique_ptr<RootWindowController> root_window_controller( | 248 std::unique_ptr<RootWindowController> root_window_controller( |
| 250 new RootWindowController(nullptr, window_tree_host.release())); | 249 new RootWindowController(nullptr, window_tree_host.release())); |
| 251 root_window_controller->Init(root_window_type); | 250 root_window_controller->Init(root_window_type); |
| 252 // TODO: To avoid lots of IPC AddActivationParent() should take an array. | |
| 253 // http://crbug.com/682048. | |
| 254 aura::Window* root_window = root_window_controller->GetRootWindow(); | |
| 255 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { | |
| 256 window_manager_client_->AddActivationParent( | |
| 257 root_window->GetChildById(kActivatableShellWindowIds[i])); | |
| 258 } | |
| 259 root_window_controllers_.insert(std::move(root_window_controller)); | 251 root_window_controllers_.insert(std::move(root_window_controller)); |
| 260 } | 252 } |
| 261 | 253 |
| 262 void WindowManager::DestroyRootWindowController( | 254 void WindowManager::DestroyRootWindowController( |
| 263 RootWindowController* root_window_controller, | 255 RootWindowController* root_window_controller, |
| 264 bool in_shutdown) { | 256 bool in_shutdown) { |
| 265 if (!in_shutdown && root_window_controllers_.size() > 1) { | 257 if (!in_shutdown && root_window_controllers_.size() > 1) { |
| 266 DCHECK_NE(root_window_controller, GetPrimaryRootWindowController()); | 258 DCHECK_NE(root_window_controller, GetPrimaryRootWindowController()); |
| 267 root_window_controller->MoveWindowsTo( | 259 root_window_controller->MoveWindowsTo( |
| 268 GetPrimaryRootWindowController()->GetRootWindow()); | 260 GetPrimaryRootWindowController()->GetRootWindow()); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 bool WindowManager::IsWindowActive(aura::Window* window) { | 560 bool WindowManager::IsWindowActive(aura::Window* window) { |
| 569 return Shell::Get()->activation_client()->GetActiveWindow() == window; | 561 return Shell::Get()->activation_client()->GetActiveWindow() == window; |
| 570 } | 562 } |
| 571 | 563 |
| 572 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { | 564 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { |
| 573 Shell::Get()->activation_client()->DeactivateWindow(window); | 565 Shell::Get()->activation_client()->DeactivateWindow(window); |
| 574 } | 566 } |
| 575 | 567 |
| 576 } // namespace mus | 568 } // namespace mus |
| 577 } // namespace ash | 569 } // namespace ash |
| OLD | NEW |