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" |
11 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" | 11 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" |
12 #include "ash/wm/mru_window_tracker.h" | 12 #include "ash/wm/mru_window_tracker.h" |
13 #include "ash/wm/overview/window_selector_controller.h" | 13 #include "ash/wm/overview/window_selector_controller.h" |
14 #include "ash/wm/workspace_controller.h" | 14 #include "ash/wm/workspace_controller.h" |
15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
16 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 namespace internal { | |
20 | 19 |
21 MaximizeModeWindowManager::~MaximizeModeWindowManager() { | 20 MaximizeModeWindowManager::~MaximizeModeWindowManager() { |
22 Shell::GetInstance()->RemoveShellObserver(this); | 21 Shell::GetInstance()->RemoveShellObserver(this); |
23 Shell::GetScreen()->RemoveObserver(this); | 22 Shell::GetScreen()->RemoveObserver(this); |
24 EnableBackdropBehindTopWindowOnEachDisplay(false); | 23 EnableBackdropBehindTopWindowOnEachDisplay(false); |
25 RemoveWindowCreationObservers(); | 24 RemoveWindowCreationObservers(); |
26 RestoreAllWindows(); | 25 RestoreAllWindows(); |
27 Shell::GetInstance()->OnMaximizeModeEnded(); | 26 Shell::GetInstance()->OnMaximizeModeEnded(); |
28 } | 27 } |
29 | 28 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return window->type() == ui::wm::WINDOW_TYPE_NORMAL; | 162 return window->type() == ui::wm::WINDOW_TYPE_NORMAL; |
164 } | 163 } |
165 | 164 |
166 void MaximizeModeWindowManager::AddWindowCreationObservers() { | 165 void MaximizeModeWindowManager::AddWindowCreationObservers() { |
167 DCHECK(observed_container_windows_.empty()); | 166 DCHECK(observed_container_windows_.empty()); |
168 // Observe window activations/creations in the default containers on all root | 167 // Observe window activations/creations in the default containers on all root |
169 // windows. | 168 // windows. |
170 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 169 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
171 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); | 170 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); |
172 iter != root_windows.end(); ++iter) { | 171 iter != root_windows.end(); ++iter) { |
173 aura::Window* container = Shell::GetContainer(*iter, | 172 aura::Window* container = |
174 internal::kShellWindowId_DefaultContainer); | 173 Shell::GetContainer(*iter, kShellWindowId_DefaultContainer); |
175 DCHECK(observed_container_windows_.find(container) == | 174 DCHECK(observed_container_windows_.find(container) == |
176 observed_container_windows_.end()); | 175 observed_container_windows_.end()); |
177 container->AddObserver(this); | 176 container->AddObserver(this); |
178 observed_container_windows_.insert(container); | 177 observed_container_windows_.insert(container); |
179 } | 178 } |
180 } | 179 } |
181 | 180 |
182 void MaximizeModeWindowManager::RemoveWindowCreationObservers() { | 181 void MaximizeModeWindowManager::RemoveWindowCreationObservers() { |
183 for (std::set<aura::Window*>::iterator iter = | 182 for (std::set<aura::Window*>::iterator iter = |
184 observed_container_windows_.begin(); | 183 observed_container_windows_.begin(); |
(...skipping 20 matching lines...) Expand all Loading... |
205 if (backdrops_hidden_) | 204 if (backdrops_hidden_) |
206 return; | 205 return; |
207 // Inform the WorkspaceLayoutManager that we want to show a backdrop behind | 206 // Inform the WorkspaceLayoutManager that we want to show a backdrop behind |
208 // the topmost window of its container. | 207 // the topmost window of its container. |
209 Shell::RootWindowControllerList controllers = | 208 Shell::RootWindowControllerList controllers = |
210 Shell::GetAllRootWindowControllers(); | 209 Shell::GetAllRootWindowControllers(); |
211 for (Shell::RootWindowControllerList::iterator iter = controllers.begin(); | 210 for (Shell::RootWindowControllerList::iterator iter = controllers.begin(); |
212 iter != controllers.end(); ++iter) { | 211 iter != controllers.end(); ++iter) { |
213 RootWindowController* controller = *iter; | 212 RootWindowController* controller = *iter; |
214 aura::Window* container = Shell::GetContainer( | 213 aura::Window* container = Shell::GetContainer( |
215 controller->root_window(), | 214 controller->root_window(), kShellWindowId_DefaultContainer); |
216 internal::kShellWindowId_DefaultContainer); | |
217 controller->workspace_controller()->SetMaximizeBackdropDelegate( | 215 controller->workspace_controller()->SetMaximizeBackdropDelegate( |
218 scoped_ptr<WorkspaceLayoutManagerDelegate>( | 216 scoped_ptr<WorkspaceLayoutManagerDelegate>( |
219 enable ? new WorkspaceBackdropDelegate(container) : NULL)); | 217 enable ? new WorkspaceBackdropDelegate(container) : NULL)); |
220 } | 218 } |
221 } | 219 } |
222 | 220 |
223 } // namespace internal | |
224 } // namespace ash | 221 } // namespace ash |
OLD | NEW |