Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 } | 303 } |
| 304 | 304 |
| 305 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { | 305 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { |
| 306 RootWindowController* controller = new RootWindowController(host, nullptr); | 306 RootWindowController* controller = new RootWindowController(host, nullptr); |
| 307 controller->Init(RootWindowType::SECONDARY); | 307 controller->Init(RootWindowType::SECONDARY); |
| 308 } | 308 } |
| 309 | 309 |
| 310 // static | 310 // static |
| 311 RootWindowController* RootWindowController::ForWindow( | 311 RootWindowController* RootWindowController::ForWindow( |
| 312 const aura::Window* window) { | 312 const aura::Window* window) { |
| 313 DCHECK(window); | |
| 314 CHECK(Shell::HasInstance()); | 313 CHECK(Shell::HasInstance()); |
| 315 return GetRootWindowController(window->GetRootWindow()); | 314 if (!window || !window->GetRootWindow()) |
|
sky
2017/05/31 21:12:43
It's unfortunate we need these checks. Are you sur
msw
2017/05/31 21:23:37
It's ported from GetRWC, but I'll try just keeping
| |
| 315 return nullptr; | |
| 316 return GetRootWindowSettings(window->GetRootWindow())->controller; | |
| 316 } | 317 } |
| 317 | 318 |
| 318 // static | 319 // static |
| 319 RootWindowController* RootWindowController::ForTargetRootWindow() { | 320 RootWindowController* RootWindowController::ForTargetRootWindow() { |
| 320 CHECK(Shell::HasInstance()); | 321 CHECK(Shell::HasInstance()); |
| 321 return GetRootWindowController(Shell::GetRootWindowForNewWindows()); | 322 return ForWindow(Shell::GetRootWindowForNewWindows()); |
| 322 } | 323 } |
| 323 | 324 |
| 324 void RootWindowController::ConfigureWidgetInitParamsForContainer( | 325 void RootWindowController::ConfigureWidgetInitParamsForContainer( |
| 325 views::Widget* widget, | 326 views::Widget* widget, |
| 326 int shell_container_id, | 327 int shell_container_id, |
| 327 views::Widget::InitParams* init_params) { | 328 views::Widget::InitParams* init_params) { |
| 328 init_params->parent = GetContainer(shell_container_id); | 329 init_params->parent = GetContainer(shell_container_id); |
| 329 } | 330 } |
| 330 | 331 |
| 331 aura::WindowTreeHost* RootWindowController::GetHost() { | 332 aura::WindowTreeHost* RootWindowController::GetHost() { |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1076 shelf_->UpdateVisibilityState(); | 1077 shelf_->UpdateVisibilityState(); |
| 1077 } | 1078 } |
| 1078 | 1079 |
| 1079 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { | 1080 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
| 1080 if (enabled) | 1081 if (enabled) |
| 1081 EnableTouchHudProjection(); | 1082 EnableTouchHudProjection(); |
| 1082 else | 1083 else |
| 1083 DisableTouchHudProjection(); | 1084 DisableTouchHudProjection(); |
| 1084 } | 1085 } |
| 1085 | 1086 |
| 1086 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | |
| 1087 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | |
| 1088 } | |
| 1089 | |
| 1090 } // namespace ash | 1087 } // namespace ash |
| OLD | NEW |