| 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/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" | 10 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" |
| 11 #include "ash/wm/mru_window_tracker.h" | 11 #include "ash/wm/mru_window_tracker.h" |
| 12 #include "ash/wm/workspace_controller.h" | 12 #include "ash/wm/workspace_controller.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/gfx/screen.h" | 14 #include "ui/gfx/screen.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 namespace internal { | 17 namespace internal { |
| 18 | 18 |
| 19 MaximizeModeWindowManager::~MaximizeModeWindowManager() { | 19 MaximizeModeWindowManager::~MaximizeModeWindowManager() { |
| 20 Shell::GetInstance()->RemoveShellObserver(this); | 20 Shell::GetInstance()->RemoveShellObserver(this); |
| 21 Shell::GetScreen()->RemoveObserver(this); | 21 Shell::GetScreen()->RemoveObserver(this); |
| 22 EnableBackdropBehindTopWindowOnEachDisplay(false); | 22 EnableBackdropBehindTopWindowOnEachDisplay(false); |
| 23 RemoveWindowCreationObservers(); | 23 RemoveWindowCreationObservers(); |
| 24 RestoreAllWindows(); | 24 RestoreAllWindows(); |
| 25 Shell::GetInstance()->OnMaximizeModeEnded(); |
| 25 } | 26 } |
| 26 | 27 |
| 27 int MaximizeModeWindowManager::GetNumberOfManagedWindows() { | 28 int MaximizeModeWindowManager::GetNumberOfManagedWindows() { |
| 28 return initial_state_type_.size(); | 29 return initial_state_type_.size(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void MaximizeModeWindowManager::OnOverviewModeStarted() { | 32 void MaximizeModeWindowManager::OnOverviewModeStarted() { |
| 32 if (backdrops_hidden_) | 33 if (backdrops_hidden_) |
| 33 return; | 34 return; |
| 34 | 35 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 DisplayConfigurationChanged(); | 87 DisplayConfigurationChanged(); |
| 87 } | 88 } |
| 88 | 89 |
| 89 MaximizeModeWindowManager::MaximizeModeWindowManager() | 90 MaximizeModeWindowManager::MaximizeModeWindowManager() |
| 90 : backdrops_hidden_(false) { | 91 : backdrops_hidden_(false) { |
| 91 // TODO(skuhne): Turn off the overview mode and full screen modes before | 92 // TODO(skuhne): Turn off the overview mode and full screen modes before |
| 92 // entering the MaximzieMode. | 93 // entering the MaximzieMode. |
| 93 MaximizeAllWindows(); | 94 MaximizeAllWindows(); |
| 94 AddWindowCreationObservers(); | 95 AddWindowCreationObservers(); |
| 95 EnableBackdropBehindTopWindowOnEachDisplay(true); | 96 EnableBackdropBehindTopWindowOnEachDisplay(true); |
| 97 Shell::GetInstance()->OnMaximizeModeStarted(); |
| 96 Shell::GetScreen()->AddObserver(this); | 98 Shell::GetScreen()->AddObserver(this); |
| 97 Shell::GetInstance()->AddShellObserver(this); | 99 Shell::GetInstance()->AddShellObserver(this); |
| 98 } | 100 } |
| 99 | 101 |
| 100 void MaximizeModeWindowManager::MaximizeAllWindows() { | 102 void MaximizeModeWindowManager::MaximizeAllWindows() { |
| 101 MruWindowTracker::WindowList windows = | 103 MruWindowTracker::WindowList windows = |
| 102 MruWindowTracker::BuildWindowList(false); | 104 MruWindowTracker::BuildWindowList(false); |
| 103 // Add all existing Mru windows. | 105 // Add all existing Mru windows. |
| 104 for (MruWindowTracker::WindowList::iterator window = windows.begin(); | 106 for (MruWindowTracker::WindowList::iterator window = windows.begin(); |
| 105 window != windows.end(); ++window) { | 107 window != windows.end(); ++window) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 controller->root_window(), | 263 controller->root_window(), |
| 262 internal::kShellWindowId_DefaultContainer); | 264 internal::kShellWindowId_DefaultContainer); |
| 263 controller->workspace_controller()->SetMaximizeBackdropDelegate( | 265 controller->workspace_controller()->SetMaximizeBackdropDelegate( |
| 264 scoped_ptr<WorkspaceLayoutManagerDelegate>( | 266 scoped_ptr<WorkspaceLayoutManagerDelegate>( |
| 265 enable ? new WorkspaceBackdropDelegate(container) : NULL)); | 267 enable ? new WorkspaceBackdropDelegate(container) : NULL)); |
| 266 } | 268 } |
| 267 } | 269 } |
| 268 | 270 |
| 269 } // namespace internal | 271 } // namespace internal |
| 270 } // namespace ash | 272 } // namespace ash |
| OLD | NEW |