| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/maximize_mode/maximize_mode_window_manager.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/session/session_state_delegate.h" | 10 #include "ash/session/session_state_delegate.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_port.h" |
| 12 #include "ash/wm/maximize_mode/maximize_mode_event_handler.h" | 13 #include "ash/wm/maximize_mode/maximize_mode_event_handler.h" |
| 13 #include "ash/wm/maximize_mode/maximize_mode_window_state.h" | 14 #include "ash/wm/maximize_mode/maximize_mode_window_state.h" |
| 14 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" | 15 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" |
| 15 #include "ash/wm/mru_window_tracker.h" | 16 #include "ash/wm/mru_window_tracker.h" |
| 16 #include "ash/wm/overview/window_selector_controller.h" | 17 #include "ash/wm/overview/window_selector_controller.h" |
| 17 #include "ash/wm/window_state.h" | 18 #include "ash/wm/window_state.h" |
| 18 #include "ash/wm/window_state_aura.h" | 19 #include "ash/wm/window_state_aura.h" |
| 19 #include "ash/wm/wm_event.h" | 20 #include "ash/wm/wm_event.h" |
| 20 #include "ash/wm/workspace_controller.h" | 21 #include "ash/wm/workspace_controller.h" |
| 21 #include "ash/wm_shell.h" | |
| 22 #include "ash/wm_window.h" | 22 #include "ash/wm_window.h" |
| 23 #include "base/command_line.h" | 23 #include "base/command_line.h" |
| 24 #include "base/memory/ptr_util.h" | 24 #include "base/memory/ptr_util.h" |
| 25 #include "base/stl_util.h" | 25 #include "base/stl_util.h" |
| 26 #include "ui/aura/client/aura_constants.h" | 26 #include "ui/aura/client/aura_constants.h" |
| 27 #include "ui/display/screen.h" | 27 #include "ui/display/screen.h" |
| 28 | 28 |
| 29 namespace ash { | 29 namespace ash { |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 : backdrops_hidden_(false) { | 200 : backdrops_hidden_(false) { |
| 201 // The overview mode needs to be ended before the maximize mode is started. To | 201 // The overview mode needs to be ended before the maximize mode is started. To |
| 202 // guarantee the proper order, it will be turned off from here. | 202 // guarantee the proper order, it will be turned off from here. |
| 203 CancelOverview(); | 203 CancelOverview(); |
| 204 | 204 |
| 205 MaximizeAllWindows(); | 205 MaximizeAllWindows(); |
| 206 AddWindowCreationObservers(); | 206 AddWindowCreationObservers(); |
| 207 EnableBackdropBehindTopWindowOnEachDisplay(true); | 207 EnableBackdropBehindTopWindowOnEachDisplay(true); |
| 208 display::Screen::GetScreen()->AddObserver(this); | 208 display::Screen::GetScreen()->AddObserver(this); |
| 209 Shell::Get()->AddShellObserver(this); | 209 Shell::Get()->AddShellObserver(this); |
| 210 event_handler_ = WmShell::Get()->CreateMaximizeModeEventHandler(); | 210 event_handler_ = ShellPort::Get()->CreateMaximizeModeEventHandler(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void MaximizeModeWindowManager::MaximizeAllWindows() { | 213 void MaximizeModeWindowManager::MaximizeAllWindows() { |
| 214 MruWindowTracker::WindowList windows = | 214 MruWindowTracker::WindowList windows = |
| 215 Shell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal(); | 215 Shell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal(); |
| 216 // Add all existing Mru windows. | 216 // Add all existing Mru windows. |
| 217 for (WmWindow* window : windows) | 217 for (WmWindow* window : windows) |
| 218 MaximizeAndTrackWindow(window); | 218 MaximizeAndTrackWindow(window); |
| 219 } | 219 } |
| 220 | 220 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 308 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 309 switches::kAshDisableMaximizeModeWindowBackdrop)) { | 309 switches::kAshDisableMaximizeModeWindowBackdrop)) { |
| 310 return; | 310 return; |
| 311 } | 311 } |
| 312 | 312 |
| 313 if (backdrops_hidden_) | 313 if (backdrops_hidden_) |
| 314 return; | 314 return; |
| 315 | 315 |
| 316 // Inform the WorkspaceLayoutManager that we want to show a backdrop behind | 316 // Inform the WorkspaceLayoutManager that we want to show a backdrop behind |
| 317 // the topmost window of its container. | 317 // the topmost window of its container. |
| 318 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { | 318 for (WmWindow* root : ShellPort::Get()->GetAllRootWindows()) { |
| 319 RootWindowController* controller = root->GetRootWindowController(); | 319 RootWindowController* controller = root->GetRootWindowController(); |
| 320 WmWindow* default_container = | 320 WmWindow* default_container = |
| 321 root->GetChildByShellWindowId(kShellWindowId_DefaultContainer); | 321 root->GetChildByShellWindowId(kShellWindowId_DefaultContainer); |
| 322 controller->workspace_controller()->SetMaximizeBackdropDelegate( | 322 controller->workspace_controller()->SetMaximizeBackdropDelegate( |
| 323 enable ? base::MakeUnique<WorkspaceBackdropDelegate>(default_container) | 323 enable ? base::MakeUnique<WorkspaceBackdropDelegate>(default_container) |
| 324 : nullptr); | 324 : nullptr); |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace ash | 328 } // namespace ash |
| OLD | NEW |