| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 WindowToState::iterator it = window_state_map_.find(window); | 74 WindowToState::iterator it = window_state_map_.find(window); |
| 75 DCHECK(it != window_state_map_.end()); | 75 DCHECK(it != window_state_map_.end()); |
| 76 window_state_map_.erase(it); | 76 window_state_map_.erase(it); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void MaximizeModeWindowManager::OnOverviewModeStarting() { | 79 void MaximizeModeWindowManager::OnOverviewModeStarting() { |
| 80 if (backdrops_hidden_) | 80 if (backdrops_hidden_) |
| 81 return; | 81 return; |
| 82 | 82 |
| 83 EnableBackdropBehindTopWindowOnEachDisplay(false); | 83 EnableBackdropBehindTopWindowOnEachDisplay(false); |
| 84 SetDeferBoundsUpdates(true); |
| 84 backdrops_hidden_ = true; | 85 backdrops_hidden_ = true; |
| 85 } | 86 } |
| 86 | 87 |
| 87 void MaximizeModeWindowManager::OnOverviewModeEnding() { | 88 void MaximizeModeWindowManager::OnOverviewModeEnding() { |
| 88 if (!backdrops_hidden_) | 89 if (!backdrops_hidden_) |
| 89 return; | 90 return; |
| 90 | 91 |
| 91 backdrops_hidden_ = false; | 92 backdrops_hidden_ = false; |
| 92 EnableBackdropBehindTopWindowOnEachDisplay(true); | 93 EnableBackdropBehindTopWindowOnEachDisplay(true); |
| 94 SetDeferBoundsUpdates(false); |
| 93 } | 95 } |
| 94 | 96 |
| 95 void MaximizeModeWindowManager::OnWindowDestroying(aura::Window* window) { | 97 void MaximizeModeWindowManager::OnWindowDestroying(aura::Window* window) { |
| 96 // If a known window gets destroyed we need to remove all knowledge about it. | 98 // If a known window gets destroyed we need to remove all knowledge about it. |
| 97 if (!IsContainerWindow(window)) | 99 if (!IsContainerWindow(window)) |
| 98 ForgetWindow(window); | 100 ForgetWindow(window); |
| 99 } | 101 } |
| 100 | 102 |
| 101 void MaximizeModeWindowManager::OnWindowAdded(aura::Window* window) { | 103 void MaximizeModeWindowManager::OnWindowAdded(aura::Window* window) { |
| 102 // A window can get removed and then re-added by a drag and drop operation. | 104 // A window can get removed and then re-added by a drag and drop operation. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 window != windows.end(); ++window) { | 189 window != windows.end(); ++window) { |
| 188 MaximizeAndTrackWindow(*window); | 190 MaximizeAndTrackWindow(*window); |
| 189 } | 191 } |
| 190 } | 192 } |
| 191 | 193 |
| 192 void MaximizeModeWindowManager::RestoreAllWindows() { | 194 void MaximizeModeWindowManager::RestoreAllWindows() { |
| 193 while (window_state_map_.size()) | 195 while (window_state_map_.size()) |
| 194 ForgetWindow(window_state_map_.begin()->first); | 196 ForgetWindow(window_state_map_.begin()->first); |
| 195 } | 197 } |
| 196 | 198 |
| 199 void MaximizeModeWindowManager::SetDeferBoundsUpdates( |
| 200 bool defer_bounds_updates) { |
| 201 for (WindowToState::iterator it = window_state_map_.begin(); |
| 202 it != window_state_map_.end(); |
| 203 ++it) { |
| 204 it->second->SetDeferBoundsUpdates(defer_bounds_updates); |
| 205 } |
| 206 } |
| 207 |
| 197 void MaximizeModeWindowManager::MaximizeAndTrackWindow( | 208 void MaximizeModeWindowManager::MaximizeAndTrackWindow( |
| 198 aura::Window* window) { | 209 aura::Window* window) { |
| 199 if (!ShouldHandleWindow(window)) | 210 if (!ShouldHandleWindow(window)) |
| 200 return; | 211 return; |
| 201 | 212 |
| 202 DCHECK(window_state_map_.find(window) == window_state_map_.end()); | 213 DCHECK(window_state_map_.find(window) == window_state_map_.end()); |
| 203 window->AddObserver(this); | 214 window->AddObserver(this); |
| 204 | 215 |
| 205 // We create and remember a maximize mode state which will attach itself to | 216 // We create and remember a maximize mode state which will attach itself to |
| 206 // the provided state object. | 217 // the provided state object. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 RootWindowController* controller = *iter; | 288 RootWindowController* controller = *iter; |
| 278 aura::Window* container = Shell::GetContainer( | 289 aura::Window* container = Shell::GetContainer( |
| 279 controller->GetRootWindow(), kShellWindowId_DefaultContainer); | 290 controller->GetRootWindow(), kShellWindowId_DefaultContainer); |
| 280 controller->workspace_controller()->SetMaximizeBackdropDelegate( | 291 controller->workspace_controller()->SetMaximizeBackdropDelegate( |
| 281 scoped_ptr<WorkspaceLayoutManagerDelegate>( | 292 scoped_ptr<WorkspaceLayoutManagerDelegate>( |
| 282 enable ? new WorkspaceBackdropDelegate(container) : NULL)); | 293 enable ? new WorkspaceBackdropDelegate(container) : NULL)); |
| 283 } | 294 } |
| 284 } | 295 } |
| 285 | 296 |
| 286 } // namespace ash | 297 } // namespace ash |
| OLD | NEW |