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/maximize_mode_window_state.h" | 10 #include "ash/wm/maximize_mode/maximize_mode_window_state.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // transforming windows which are currently in | 41 // transforming windows which are currently in |
42 // overview: http://crbug.com/366605 | 42 // overview: http://crbug.com/366605 |
43 CancelOverview(); | 43 CancelOverview(); |
44 | 44 |
45 Shell::GetInstance()->RemovePreTargetHandler(this); | 45 Shell::GetInstance()->RemovePreTargetHandler(this); |
46 Shell::GetInstance()->RemoveShellObserver(this); | 46 Shell::GetInstance()->RemoveShellObserver(this); |
47 Shell::GetScreen()->RemoveObserver(this); | 47 Shell::GetScreen()->RemoveObserver(this); |
48 EnableBackdropBehindTopWindowOnEachDisplay(false); | 48 EnableBackdropBehindTopWindowOnEachDisplay(false); |
49 RemoveWindowCreationObservers(); | 49 RemoveWindowCreationObservers(); |
50 RestoreAllWindows(); | 50 RestoreAllWindows(); |
51 Shell::GetInstance()->OnMaximizeModeEnded(); | |
52 } | 51 } |
53 | 52 |
54 int MaximizeModeWindowManager::GetNumberOfManagedWindows() { | 53 int MaximizeModeWindowManager::GetNumberOfManagedWindows() { |
55 return window_state_map_.size(); | 54 return window_state_map_.size(); |
56 } | 55 } |
57 | 56 |
58 void MaximizeModeWindowManager::WindowStateDestroyed(aura::Window* window) { | 57 void MaximizeModeWindowManager::WindowStateDestroyed(aura::Window* window) { |
59 // At this time ForgetWindow() should already have been called. If not, | 58 // At this time ForgetWindow() should already have been called. If not, |
60 // someone else must have replaced the "window manager's state object". | 59 // someone else must have replaced the "window manager's state object". |
61 DCHECK(!window->HasObserver(this)); | 60 DCHECK(!window->HasObserver(this)); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 155 |
157 MaximizeModeWindowManager::MaximizeModeWindowManager() | 156 MaximizeModeWindowManager::MaximizeModeWindowManager() |
158 : backdrops_hidden_(false) { | 157 : backdrops_hidden_(false) { |
159 // The overview mode needs to be ended before the maximize mode is started. To | 158 // The overview mode needs to be ended before the maximize mode is started. To |
160 // guarantee the proper order, it will be turned off from here. | 159 // guarantee the proper order, it will be turned off from here. |
161 CancelOverview(); | 160 CancelOverview(); |
162 | 161 |
163 MaximizeAllWindows(); | 162 MaximizeAllWindows(); |
164 AddWindowCreationObservers(); | 163 AddWindowCreationObservers(); |
165 EnableBackdropBehindTopWindowOnEachDisplay(true); | 164 EnableBackdropBehindTopWindowOnEachDisplay(true); |
166 Shell::GetInstance()->OnMaximizeModeStarted(); | |
167 Shell::GetScreen()->AddObserver(this); | 165 Shell::GetScreen()->AddObserver(this); |
168 Shell::GetInstance()->AddShellObserver(this); | 166 Shell::GetInstance()->AddShellObserver(this); |
169 Shell::GetInstance()->AddPreTargetHandler(this); | 167 Shell::GetInstance()->AddPreTargetHandler(this); |
170 } | 168 } |
171 | 169 |
172 void MaximizeModeWindowManager::MaximizeAllWindows() { | 170 void MaximizeModeWindowManager::MaximizeAllWindows() { |
173 MruWindowTracker::WindowList windows = | 171 MruWindowTracker::WindowList windows = |
174 MruWindowTracker::BuildWindowList(false); | 172 MruWindowTracker::BuildWindowList(false); |
175 // Add all existing Mru windows. | 173 // Add all existing Mru windows. |
176 for (MruWindowTracker::WindowList::iterator window = windows.begin(); | 174 for (MruWindowTracker::WindowList::iterator window = windows.begin(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 RootWindowController* controller = *iter; | 265 RootWindowController* controller = *iter; |
268 aura::Window* container = Shell::GetContainer( | 266 aura::Window* container = Shell::GetContainer( |
269 controller->GetRootWindow(), kShellWindowId_DefaultContainer); | 267 controller->GetRootWindow(), kShellWindowId_DefaultContainer); |
270 controller->workspace_controller()->SetMaximizeBackdropDelegate( | 268 controller->workspace_controller()->SetMaximizeBackdropDelegate( |
271 scoped_ptr<WorkspaceLayoutManagerDelegate>( | 269 scoped_ptr<WorkspaceLayoutManagerDelegate>( |
272 enable ? new WorkspaceBackdropDelegate(container) : NULL)); | 270 enable ? new WorkspaceBackdropDelegate(container) : NULL)); |
273 } | 271 } |
274 } | 272 } |
275 | 273 |
276 } // namespace ash | 274 } // namespace ash |
OLD | NEW |