| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 RootWindowController::RootWindowController( | 70 RootWindowController::RootWindowController( |
| 71 WindowManager* window_manager, | 71 WindowManager* window_manager, |
| 72 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 72 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 73 const display::Display& display, | 73 const display::Display& display, |
| 74 ash::RootWindowController::RootWindowType root_window_type) | 74 ash::RootWindowController::RootWindowType root_window_type) |
| 75 : window_manager_(window_manager), | 75 : window_manager_(window_manager), |
| 76 window_tree_host_(window_tree_host.get()), | 76 window_tree_host_(window_tree_host.get()), |
| 77 window_count_(0), | 77 window_count_(0), |
| 78 display_(display) { | 78 display_(display) { |
| 79 ash::InitRootWindowSettings(window_tree_host->window()); | 79 RootWindowSettings* root_window_settings = |
| 80 InitRootWindowSettings(window_tree_host->window()); |
| 81 root_window_settings->display_id = display.id(); |
| 80 window_tree_host->window()->SetProperty(kRootWindowControllerKey, this); | 82 window_tree_host->window()->SetProperty(kRootWindowControllerKey, this); |
| 81 WmShellMus::Get()->AddRootWindowController(this); | |
| 82 ash_root_window_controller_ = base::WrapUnique( | 83 ash_root_window_controller_ = base::WrapUnique( |
| 83 new ash::RootWindowController(nullptr, window_tree_host.release())); | 84 new ash::RootWindowController(nullptr, window_tree_host.release())); |
| 84 ash_root_window_controller_->Init(root_window_type); | 85 ash_root_window_controller_->Init(root_window_type); |
| 85 | 86 |
| 87 // TODO: To avoid lots of IPC AddActivationParent() should take an array. |
| 88 // http://crbug.com/682048. |
| 86 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { | 89 for (size_t i = 0; i < kNumActivatableShellWindowIds; ++i) { |
| 87 window_manager_->window_manager_client()->AddActivationParent( | 90 window_manager_->window_manager_client()->AddActivationParent( |
| 88 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->aura_window()); | 91 GetWindowByShellWindowId(kActivatableShellWindowIds[i])->aura_window()); |
| 89 } | 92 } |
| 90 } | 93 } |
| 91 | 94 |
| 92 RootWindowController::~RootWindowController() { | 95 RootWindowController::~RootWindowController() { |
| 93 Shutdown(); | 96 Shutdown(); |
| 94 ash_root_window_controller_.reset(); | 97 ash_root_window_controller_.reset(); |
| 95 WmShellMus::Get()->RemoveRootWindowController(this); | |
| 96 } | 98 } |
| 97 | 99 |
| 98 // static | 100 // static |
| 99 RootWindowController* RootWindowController::ForWindow(aura::Window* window) { | 101 RootWindowController* RootWindowController::ForWindow(aura::Window* window) { |
| 100 return window->GetRootWindow()->GetProperty(kRootWindowControllerKey); | 102 return window->GetRootWindow()->GetProperty(kRootWindowControllerKey); |
| 101 } | 103 } |
| 102 | 104 |
| 103 void RootWindowController::Shutdown() { | 105 void RootWindowController::Shutdown() { |
| 104 // NOTE: Shutdown() may be called multiple times. | 106 // NOTE: Shutdown() may be called multiple times. |
| 105 ash_root_window_controller_->Shutdown(); | 107 ash_root_window_controller_->Shutdown(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } else { | 236 } else { |
| 235 width = root()->bounds().width() - 240; | 237 width = root()->bounds().width() - 240; |
| 236 height = root()->bounds().height() - 240; | 238 height = root()->bounds().height() - 240; |
| 237 } | 239 } |
| 238 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40, | 240 return gfx::Rect(40 + (window_count_ % 4) * 40, 40 + (window_count_ % 4) * 40, |
| 239 width, height); | 241 width, height); |
| 240 } | 242 } |
| 241 | 243 |
| 242 } // namespace mus | 244 } // namespace mus |
| 243 } // namespace ash | 245 } // namespace ash |
| OLD | NEW |