| 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/wm/container_finder.h" | 13 #include "ash/common/wm/container_finder.h" |
| 13 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
| 14 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
| 15 #include "ash/display/screen_position_controller.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" | 23 #include "ash/mus/root_window_controller.h" |
| 24 #include "ash/mus/screen_mus.h" | 24 #include "ash/mus/screen_mus.h" |
| 25 #include "ash/mus/shadow_controller.h" | 25 #include "ash/mus/shadow_controller.h" |
| 26 #include "ash/mus/shell_delegate_mus.h" | 26 #include "ash/mus/shell_delegate_mus.h" |
| 27 #include "ash/mus/window_manager_observer.h" | |
| 28 #include "ash/mus/window_properties.h" | 27 #include "ash/mus/window_properties.h" |
| 29 #include "ash/public/cpp/shell_window_ids.h" | 28 #include "ash/public/cpp/shell_window_ids.h" |
| 30 #include "ash/root_window_controller.h" | 29 #include "ash/root_window_controller.h" |
| 31 #include "ash/shell.h" | 30 #include "ash/shell.h" |
| 31 #include "ash/shell_init_params.h" |
| 32 #include "ash/wm/ash_focus_rules.h" | 32 #include "ash/wm/ash_focus_rules.h" |
| 33 #include "ash/wm/event_client_impl.h" | |
| 34 #include "ash/wm/window_properties.h" | 33 #include "ash/wm/window_properties.h" |
| 35 #include "base/memory/ptr_util.h" | 34 #include "base/memory/ptr_util.h" |
| 36 #include "services/service_manager/public/cpp/connector.h" | 35 #include "services/service_manager/public/cpp/connector.h" |
| 37 #include "services/ui/common/accelerator_util.h" | 36 #include "services/ui/common/accelerator_util.h" |
| 38 #include "services/ui/common/types.h" | 37 #include "services/ui/common/types.h" |
| 39 #include "services/ui/public/cpp/property_type_converters.h" | 38 #include "services/ui/public/cpp/property_type_converters.h" |
| 40 #include "services/ui/public/interfaces/constants.mojom.h" | 39 #include "services/ui/public/interfaces/constants.mojom.h" |
| 41 #include "services/ui/public/interfaces/window_manager.mojom.h" | 40 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 42 #include "ui/aura/client/window_parenting_client.h" | 41 #include "ui/aura/client/window_parenting_client.h" |
| 43 #include "ui/aura/env.h" | 42 #include "ui/aura/env.h" |
| 44 #include "ui/aura/mus/property_converter.h" | 43 #include "ui/aura/mus/property_converter.h" |
| 45 #include "ui/aura/mus/window_tree_client.h" | 44 #include "ui/aura/mus/window_tree_client.h" |
| 46 #include "ui/aura/mus/window_tree_host_mus.h" | 45 #include "ui/aura/mus/window_tree_host_mus.h" |
| 47 #include "ui/aura/window.h" | 46 #include "ui/aura/window.h" |
| 48 #include "ui/aura/window_property.h" | 47 #include "ui/aura/window_property.h" |
| 49 #include "ui/base/hit_test.h" | 48 #include "ui/base/hit_test.h" |
| 50 #include "ui/display/display_observer.h" | 49 #include "ui/display/display_observer.h" |
| 51 #include "ui/events/mojo/event.mojom.h" | 50 #include "ui/events/mojo/event.mojom.h" |
| 52 #include "ui/views/mus/pointer_watcher_event_router.h" | 51 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 53 #include "ui/views/mus/screen_mus.h" | 52 #include "ui/views/mus/screen_mus.h" |
| 54 #include "ui/wm/core/capture_controller.h" | 53 #include "ui/wm/core/capture_controller.h" |
| 55 #include "ui/wm/core/focus_controller.h" | |
| 56 #include "ui/wm/core/wm_state.h" | 54 #include "ui/wm/core/wm_state.h" |
| 55 #include "ui/wm/public/activation_client.h" |
| 57 | 56 |
| 58 namespace ash { | 57 namespace ash { |
| 59 namespace mus { | 58 namespace mus { |
| 60 namespace { | |
| 61 | |
| 62 // TODO: this is temporary until WindowManager create the real Shell (which is | |
| 63 // the event target). http://crbug.com/670744. | |
| 64 class EventClientImplMus : public EventClientImpl { | |
| 65 public: | |
| 66 EventClientImplMus() = default; | |
| 67 ~EventClientImplMus() override = default; | |
| 68 | |
| 69 // EventClientImpl: | |
| 70 ui::EventTarget* GetToplevelEventTarget() override { return nullptr; } | |
| 71 | |
| 72 private: | |
| 73 DISALLOW_COPY_AND_ASSIGN(EventClientImplMus); | |
| 74 }; | |
| 75 | |
| 76 } // namespace | |
| 77 | 59 |
| 78 // TODO: need to register OSExchangeDataProviderMus. http://crbug.com/665077. | 60 // TODO: need to register OSExchangeDataProviderMus. http://crbug.com/665077. |
| 79 WindowManager::WindowManager(service_manager::Connector* connector) | 61 WindowManager::WindowManager(service_manager::Connector* connector) |
| 80 : connector_(connector), | 62 : connector_(connector), |
| 81 focus_controller_(base::MakeUnique<::wm::FocusController>( | |
| 82 new ::ash::wm::AshFocusRules())), | |
| 83 wm_state_(base::MakeUnique<::wm::WMState>()), | 63 wm_state_(base::MakeUnique<::wm::WMState>()), |
| 84 property_converter_(base::MakeUnique<aura::PropertyConverter>()), | 64 property_converter_(base::MakeUnique<aura::PropertyConverter>()) { |
| 85 event_client_(base::MakeUnique<EventClientImplMus>()), | |
| 86 screen_position_controller_( | |
| 87 base::MakeUnique<ScreenPositionController>()) { | |
| 88 property_converter_->RegisterProperty( | 65 property_converter_->RegisterProperty( |
| 89 kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property); | 66 kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property); |
| 90 property_converter_->RegisterProperty( | 67 property_converter_->RegisterProperty( |
| 91 kRenderTitleAreaProperty, | 68 kRenderTitleAreaProperty, |
| 92 ui::mojom::WindowManager::kRenderParentTitleArea_Property); | 69 ui::mojom::WindowManager::kRenderParentTitleArea_Property); |
| 93 property_converter_->RegisterProperty( | 70 property_converter_->RegisterProperty( |
| 94 kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property); | 71 kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property); |
| 95 } | 72 } |
| 96 | 73 |
| 97 WindowManager::~WindowManager() { | 74 WindowManager::~WindowManager() { |
| 98 Shutdown(); | 75 Shutdown(); |
| 99 ash::Shell::set_window_tree_client(nullptr); | 76 ash::Shell::set_window_tree_client(nullptr); |
| 100 ash::Shell::set_window_manager_client(nullptr); | 77 ash::Shell::set_window_manager_client(nullptr); |
| 101 } | 78 } |
| 102 | 79 |
| 103 void WindowManager::Init( | 80 void WindowManager::Init( |
| 104 std::unique_ptr<aura::WindowTreeClient> window_tree_client, | 81 std::unique_ptr<aura::WindowTreeClient> window_tree_client, |
| 105 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) { | 82 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) { |
| 83 blocking_pool_ = blocking_pool; |
| 106 DCHECK(window_manager_client_); | 84 DCHECK(window_manager_client_); |
| 107 DCHECK(!window_tree_client_); | 85 DCHECK(!window_tree_client_); |
| 108 window_tree_client_ = std::move(window_tree_client); | 86 window_tree_client_ = std::move(window_tree_client); |
| 109 | 87 |
| 110 DCHECK_EQ(nullptr, ash::Shell::window_tree_client()); | 88 DCHECK_EQ(nullptr, ash::Shell::window_tree_client()); |
| 111 ash::Shell::set_window_tree_client(window_tree_client_.get()); | 89 ash::Shell::set_window_tree_client(window_tree_client_.get()); |
| 112 | 90 |
| 113 // |connector_| will be null in some tests. | 91 // |connector_| will be null in some tests. |
| 114 if (connector_) | 92 if (connector_) |
| 115 connector_->BindInterface(ui::mojom::kServiceName, &display_controller_); | 93 connector_->BindInterface(ui::mojom::kServiceName, &display_controller_); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 127 ui::mojom::FrameDecorationValues::New(); | 105 ui::mojom::FrameDecorationValues::New(); |
| 128 const gfx::Insets client_area_insets = | 106 const gfx::Insets client_area_insets = |
| 129 NonClientFrameController::GetPreferredClientAreaInsets(); | 107 NonClientFrameController::GetPreferredClientAreaInsets(); |
| 130 frame_decoration_values->normal_client_area_insets = client_area_insets; | 108 frame_decoration_values->normal_client_area_insets = client_area_insets; |
| 131 frame_decoration_values->maximized_client_area_insets = client_area_insets; | 109 frame_decoration_values->maximized_client_area_insets = client_area_insets; |
| 132 frame_decoration_values->max_title_bar_button_width = | 110 frame_decoration_values->max_title_bar_button_width = |
| 133 NonClientFrameController::GetMaxTitleBarButtonWidth(); | 111 NonClientFrameController::GetMaxTitleBarButtonWidth(); |
| 134 window_manager_client_->SetFrameDecorationValues( | 112 window_manager_client_->SetFrameDecorationValues( |
| 135 std::move(frame_decoration_values)); | 113 std::move(frame_decoration_values)); |
| 136 | 114 |
| 137 shell_.reset(new WmShellMus(base::MakeUnique<ShellDelegateMus>(connector_), | |
| 138 this, pointer_watcher_event_router_.get())); | |
| 139 shell_->Initialize(blocking_pool); | |
| 140 lookup_.reset(new WmLookupMus); | 115 lookup_.reset(new WmLookupMus); |
| 141 } | 116 } |
| 142 | 117 |
| 143 aura::client::ActivationClient* WindowManager::activation_client() { | 118 void WindowManager::DeleteAllRootWindowControllers() { |
| 144 return focus_controller_.get(); | 119 // Primary RootWindowController must be destroyed last. |
| 120 RootWindowController* primary_root_window_controller = |
| 121 GetPrimaryRootWindowController(); |
| 122 std::set<RootWindowController*> secondary_root_window_controllers; |
| 123 for (auto& root_window_controller_ptr : root_window_controllers_) { |
| 124 if (root_window_controller_ptr.get() != primary_root_window_controller) { |
| 125 secondary_root_window_controllers.insert( |
| 126 root_window_controller_ptr.get()); |
| 127 } |
| 128 } |
| 129 const bool in_shutdown = true; |
| 130 for (RootWindowController* root_window_controller : |
| 131 secondary_root_window_controllers) { |
| 132 DestroyRootWindowController(root_window_controller, in_shutdown); |
| 133 } |
| 134 if (primary_root_window_controller) |
| 135 DestroyRootWindowController(primary_root_window_controller, in_shutdown); |
| 136 DCHECK(root_window_controllers_.empty()); |
| 145 } | 137 } |
| 146 | 138 |
| 147 aura::Window* WindowManager::NewTopLevelWindow( | 139 aura::Window* WindowManager::NewTopLevelWindow( |
| 148 ui::mojom::WindowType window_type, | 140 ui::mojom::WindowType window_type, |
| 149 std::map<std::string, std::vector<uint8_t>>* properties) { | 141 std::map<std::string, std::vector<uint8_t>>* properties) { |
| 150 RootWindowController* root_window_controller = | 142 RootWindowController* root_window_controller = |
| 151 GetRootWindowControllerForNewTopLevelWindow(properties); | 143 GetRootWindowControllerForNewTopLevelWindow(properties); |
| 152 aura::Window* window = | 144 aura::Window* window = |
| 153 root_window_controller->NewTopLevelWindow(window_type, properties); | 145 root_window_controller->NewTopLevelWindow(window_type, properties); |
| 154 if (properties->count( | 146 if (properties->count( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 183 void WindowManager::AddAcceleratorHandler(uint16_t id_namespace, | 175 void WindowManager::AddAcceleratorHandler(uint16_t id_namespace, |
| 184 AcceleratorHandler* handler) { | 176 AcceleratorHandler* handler) { |
| 185 DCHECK_EQ(0u, accelerator_handlers_.count(id_namespace)); | 177 DCHECK_EQ(0u, accelerator_handlers_.count(id_namespace)); |
| 186 accelerator_handlers_[id_namespace] = handler; | 178 accelerator_handlers_[id_namespace] = handler; |
| 187 } | 179 } |
| 188 | 180 |
| 189 void WindowManager::RemoveAcceleratorHandler(uint16_t id_namespace) { | 181 void WindowManager::RemoveAcceleratorHandler(uint16_t id_namespace) { |
| 190 accelerator_handlers_.erase(id_namespace); | 182 accelerator_handlers_.erase(id_namespace); |
| 191 } | 183 } |
| 192 | 184 |
| 193 void WindowManager::AddObserver(WindowManagerObserver* observer) { | |
| 194 observers_.AddObserver(observer); | |
| 195 } | |
| 196 | |
| 197 void WindowManager::RemoveObserver(WindowManagerObserver* observer) { | |
| 198 observers_.RemoveObserver(observer); | |
| 199 } | |
| 200 | |
| 201 display::mojom::DisplayController* WindowManager::GetDisplayController() { | 185 display::mojom::DisplayController* WindowManager::GetDisplayController() { |
| 202 return display_controller_ ? display_controller_.get() : nullptr; | 186 return display_controller_ ? display_controller_.get() : nullptr; |
| 203 } | 187 } |
| 204 | 188 |
| 205 RootWindowController* WindowManager::CreateRootWindowController( | 189 void WindowManager::CreatePrimaryRootWindowController( |
| 190 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 191 // See comment in CreateRootWindowController(). |
| 192 DCHECK(created_shell_); |
| 193 std::unique_ptr<RootWindowController> root_window_controller_ptr( |
| 194 new RootWindowController( |
| 195 this, std::move(window_tree_host), screen_->GetAllDisplays()[0], |
| 196 ash::RootWindowController::RootWindowType::PRIMARY)); |
| 197 root_window_controllers_.insert(std::move(root_window_controller_ptr)); |
| 198 } |
| 199 |
| 200 void WindowManager::CreateShell( |
| 201 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 202 DCHECK(!created_shell_); |
| 203 created_shell_ = true; |
| 204 ShellInitParams init_params; |
| 205 WmShellMus* wm_shell = |
| 206 new WmShellMus(WmWindow::Get(window_tree_host->window()), |
| 207 base::MakeUnique<ShellDelegateMus>( |
| 208 connector_, std::move(system_tray_delegate_for_test_)), |
| 209 this, pointer_watcher_event_router_.get()); |
| 210 init_params.primary_window_tree_host = window_tree_host.release(); |
| 211 init_params.wm_shell = wm_shell; |
| 212 init_params.blocking_pool = blocking_pool_.get(); |
| 213 Shell::CreateInstance(init_params); |
| 214 } |
| 215 |
| 216 void WindowManager::CreateRootWindowController( |
| 206 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 217 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 207 const display::Display& display, | 218 const display::Display& display, |
| 208 ash::RootWindowController::RootWindowType root_window_type) { | 219 ash::RootWindowController::RootWindowType root_window_type) { |
| 209 // TODO(sky): all of these calls to SetFooClient() are done in | 220 // The ash startup sequence creates the Shell, which creates |
| 210 // Shell::InitRootWindow(). When Shell is used these can be removed. | 221 // WindowTreeHostManager, which creates the WindowTreeHosts and |
| 211 aura::client::SetFocusClient(window_tree_host->window(), | 222 // RootWindowControllers. For mash we are supplied the WindowTreeHost when |
| 212 focus_controller_.get()); | 223 // a display is added (and WindowTreeHostManager is not used in mash). Mash |
| 213 aura::client::SetActivationClient(window_tree_host->window(), | 224 // waits for the first WindowTreeHost, then creates the shell. As there are |
| 214 focus_controller_.get()); | 225 // order dependencies we have to create the RootWindowController at a similar |
| 215 aura::client::SetEventClient(window_tree_host->window(), event_client_.get()); | 226 // time as cash, to do that we inject the WindowTreeHost into ShellInitParams. |
| 216 aura::client::SetScreenPositionClient(window_tree_host->window(), | 227 // Shell calls to WmShell::InitHosts(), which calls back to |
| 217 screen_position_controller_.get()); | 228 // CreatePrimaryRootWindowController(). |
| 218 | 229 if (!created_shell_) { |
| 230 CreateShell(std::move(window_tree_host)); |
| 231 return; |
| 232 } |
| 219 std::unique_ptr<RootWindowController> root_window_controller_ptr( | 233 std::unique_ptr<RootWindowController> root_window_controller_ptr( |
| 220 new RootWindowController(this, std::move(window_tree_host), display, | 234 new RootWindowController( |
| 221 root_window_type)); | 235 this, std::move(window_tree_host), display, |
| 222 RootWindowController* root_window_controller = | 236 ash::RootWindowController::RootWindowType::SECONDARY)); |
| 223 root_window_controller_ptr.get(); | |
| 224 root_window_controllers_.insert(std::move(root_window_controller_ptr)); | 237 root_window_controllers_.insert(std::move(root_window_controller_ptr)); |
| 225 | 238 |
| 226 // Create a shelf if a user is already logged in. | |
| 227 if (shell_->session_controller()->NumberOfLoggedInUsers()) | |
| 228 root_window_controller->ash_root_window_controller()->CreateShelf(); | |
| 229 | |
| 230 for (auto& observer : observers_) | |
| 231 observer.OnRootWindowControllerAdded(root_window_controller); | |
| 232 | |
| 233 for (auto& observer : *screen_->display_list().observers()) | 239 for (auto& observer : *screen_->display_list().observers()) |
| 234 observer.OnDisplayAdded(root_window_controller->display()); | 240 observer.OnDisplayAdded(display); |
| 235 | |
| 236 return root_window_controller; | |
| 237 } | 241 } |
| 238 | 242 |
| 239 void WindowManager::DestroyRootWindowController( | 243 void WindowManager::DestroyRootWindowController( |
| 240 RootWindowController* root_window_controller) { | 244 RootWindowController* root_window_controller, |
| 241 if (root_window_controllers_.size() > 1) { | 245 bool in_shutdown) { |
| 246 if (!in_shutdown && root_window_controllers_.size() > 1) { |
| 242 DCHECK_NE(root_window_controller, GetPrimaryRootWindowController()); | 247 DCHECK_NE(root_window_controller, GetPrimaryRootWindowController()); |
| 243 root_window_controller->ash_root_window_controller()->MoveWindowsTo( | 248 root_window_controller->ash_root_window_controller()->MoveWindowsTo( |
| 244 GetPrimaryRootWindowController()->root()); | 249 GetPrimaryRootWindowController()->root()); |
| 245 } | 250 } |
| 246 | 251 |
| 247 root_window_controller->Shutdown(); | 252 root_window_controller->Shutdown(); |
| 248 | 253 |
| 249 // NOTE: classic ash deleted RootWindowController after a delay (DeleteSoon()) | |
| 250 // this may need to change to mirror that. | |
| 251 for (auto iter = root_window_controllers_.begin(); | 254 for (auto iter = root_window_controllers_.begin(); |
| 252 iter != root_window_controllers_.end(); ++iter) { | 255 iter != root_window_controllers_.end(); ++iter) { |
| 253 if (iter->get() == root_window_controller) { | 256 if (iter->get() == root_window_controller) { |
| 254 root_window_controllers_.erase(iter); | 257 root_window_controllers_.erase(iter); |
| 255 break; | 258 break; |
| 256 } | 259 } |
| 257 } | 260 } |
| 258 } | 261 } |
| 259 | 262 |
| 260 void WindowManager::Shutdown() { | 263 void WindowManager::Shutdown() { |
| 261 if (!window_tree_client_) | 264 if (!window_tree_client_) |
| 262 return; | 265 return; |
| 263 | 266 |
| 264 // Remove the focus from any window. This will prevent overhead and side | 267 Shell::DeleteInstance(); |
| 265 // effects (e.g. crashes) from changing focus during shutdown. | |
| 266 // See bug crbug.com/134502. | |
| 267 static_cast<aura::client::FocusClient*>(focus_controller_.get()) | |
| 268 ->FocusWindow(nullptr); | |
| 269 | |
| 270 // Observers can rely on WmShell from the callback. So notify the observers | |
| 271 // before destroying it. | |
| 272 for (auto& observer : observers_) | |
| 273 observer.OnWindowTreeClientDestroyed(); | |
| 274 | |
| 275 // Primary RootWindowController must be destroyed last. | |
| 276 RootWindowController* primary_root_window_controller = | |
| 277 GetPrimaryRootWindowController(); | |
| 278 std::set<RootWindowController*> secondary_root_window_controllers; | |
| 279 for (auto& root_window_controller_ptr : root_window_controllers_) { | |
| 280 if (root_window_controller_ptr.get() != primary_root_window_controller) | |
| 281 secondary_root_window_controllers.insert( | |
| 282 root_window_controller_ptr.get()); | |
| 283 } | |
| 284 for (RootWindowController* root_window_controller : | |
| 285 secondary_root_window_controllers) { | |
| 286 DestroyRootWindowController(root_window_controller); | |
| 287 } | |
| 288 if (primary_root_window_controller) | |
| 289 DestroyRootWindowController(primary_root_window_controller); | |
| 290 | |
| 291 DCHECK(root_window_controllers_.empty()); | |
| 292 | 268 |
| 293 lookup_.reset(); | 269 lookup_.reset(); |
| 294 shell_->Shutdown(); | |
| 295 shell_.reset(); | |
| 296 shadow_controller_.reset(); | 270 shadow_controller_.reset(); |
| 297 | 271 |
| 298 pointer_watcher_event_router_.reset(); | 272 pointer_watcher_event_router_.reset(); |
| 299 | 273 |
| 300 window_tree_client_.reset(); | 274 window_tree_client_.reset(); |
| 301 window_manager_client_ = nullptr; | 275 window_manager_client_ = nullptr; |
| 302 | |
| 303 DCHECK_EQ(screen_.get(), display::Screen::GetScreen()); | |
| 304 display::Screen::SetScreenInstance(nullptr); | |
| 305 } | 276 } |
| 306 | 277 |
| 307 RootWindowController* WindowManager::GetPrimaryRootWindowController() { | 278 RootWindowController* WindowManager::GetPrimaryRootWindowController() { |
| 308 return RootWindowController::ForWindow(WmShell::Get() | 279 return RootWindowController::ForWindow(WmShell::Get() |
| 309 ->GetPrimaryRootWindowController() | 280 ->GetPrimaryRootWindowController() |
| 310 ->GetWindow() | 281 ->GetWindow() |
| 311 ->aura_window()); | 282 ->aura_window()); |
| 312 } | 283 } |
| 313 | 284 |
| 314 RootWindowController* | 285 RootWindowController* |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 ? ash::RootWindowController::RootWindowType::PRIMARY | 403 ? ash::RootWindowController::RootWindowType::PRIMARY |
| 433 : ash::RootWindowController::RootWindowType::SECONDARY; | 404 : ash::RootWindowController::RootWindowType::SECONDARY; |
| 434 CreateRootWindowController(std::move(window_tree_host), display, | 405 CreateRootWindowController(std::move(window_tree_host), display, |
| 435 root_window_type); | 406 root_window_type); |
| 436 } | 407 } |
| 437 | 408 |
| 438 void WindowManager::OnWmDisplayRemoved( | 409 void WindowManager::OnWmDisplayRemoved( |
| 439 aura::WindowTreeHostMus* window_tree_host) { | 410 aura::WindowTreeHostMus* window_tree_host) { |
| 440 for (auto& root_window_controller_ptr : root_window_controllers_) { | 411 for (auto& root_window_controller_ptr : root_window_controllers_) { |
| 441 if (root_window_controller_ptr->window_tree_host() == window_tree_host) { | 412 if (root_window_controller_ptr->window_tree_host() == window_tree_host) { |
| 442 DestroyRootWindowController(root_window_controller_ptr.get()); | 413 const bool in_shutdown = false; |
| 414 DestroyRootWindowController(root_window_controller_ptr.get(), |
| 415 in_shutdown); |
| 443 break; | 416 break; |
| 444 } | 417 } |
| 445 } | 418 } |
| 446 } | 419 } |
| 447 | 420 |
| 448 void WindowManager::OnWmDisplayModified(const display::Display& display) { | 421 void WindowManager::OnWmDisplayModified(const display::Display& display) { |
| 449 for (auto& controller : root_window_controllers_) { | 422 for (auto& controller : root_window_controllers_) { |
| 450 if (controller->display().id() == display.id()) { | 423 if (controller->display().id() == display.id()) { |
| 451 controller->SetDisplay(display); | 424 controller->SetDisplay(display); |
| 452 // The root window will be resized by the window server. | 425 // The root window will be resized by the window server. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 const gfx::Insets& insets, | 471 const gfx::Insets& insets, |
| 499 const std::vector<gfx::Rect>& additional_client_areas) { | 472 const std::vector<gfx::Rect>& additional_client_areas) { |
| 500 NonClientFrameController* non_client_frame_controller = | 473 NonClientFrameController* non_client_frame_controller = |
| 501 NonClientFrameController::Get(window); | 474 NonClientFrameController::Get(window); |
| 502 if (!non_client_frame_controller) | 475 if (!non_client_frame_controller) |
| 503 return; | 476 return; |
| 504 non_client_frame_controller->SetClientArea(insets, additional_client_areas); | 477 non_client_frame_controller->SetClientArea(insets, additional_client_areas); |
| 505 } | 478 } |
| 506 | 479 |
| 507 bool WindowManager::IsWindowActive(aura::Window* window) { | 480 bool WindowManager::IsWindowActive(aura::Window* window) { |
| 508 return activation_client()->GetActiveWindow() == window; | 481 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; |
| 509 } | 482 } |
| 510 | 483 |
| 511 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { | 484 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { |
| 512 activation_client()->DeactivateWindow(window); | 485 Shell::GetInstance()->activation_client()->DeactivateWindow(window); |
| 513 } | 486 } |
| 514 | 487 |
| 515 } // namespace mus | 488 } // namespace mus |
| 516 } // namespace ash | 489 } // namespace ash |
| OLD | NEW |