| 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/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // and not yet tracked. | 66 // and not yet tracked. |
| 67 if (!ShouldHandleWindow(window) || | 67 if (!ShouldHandleWindow(window) || |
| 68 window_state_map_.find(window) != window_state_map_.end() || | 68 window_state_map_.find(window) != window_state_map_.end() || |
| 69 !IsContainerWindow(window->parent())) { | 69 !IsContainerWindow(window->parent())) { |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 MaximizeAndTrackWindow(window); | 73 MaximizeAndTrackWindow(window); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void MaximizeModeWindowManager::WindowStateDestroyed(aura::Window* window) { | 76 void MaximizeModeWindowManager::WindowStateDestroyed(WmWindow* wm_window) { |
| 77 aura::Window* window = WmWindowAura::GetAuraWindow(wm_window); |
| 77 // At this time ForgetWindow() should already have been called. If not, | 78 // At this time ForgetWindow() should already have been called. If not, |
| 78 // someone else must have replaced the "window manager's state object". | 79 // someone else must have replaced the "window manager's state object". |
| 79 DCHECK(!window->HasObserver(this)); | 80 DCHECK(!window->HasObserver(this)); |
| 80 | 81 |
| 81 WindowToState::iterator it = window_state_map_.find(window); | 82 WindowToState::iterator it = window_state_map_.find(window); |
| 82 DCHECK(it != window_state_map_.end()); | 83 DCHECK(it != window_state_map_.end()); |
| 83 window_state_map_.erase(it); | 84 window_state_map_.erase(it); |
| 84 } | 85 } |
| 85 | 86 |
| 86 void MaximizeModeWindowManager::OnOverviewModeStarting() { | 87 void MaximizeModeWindowManager::OnOverviewModeStarting() { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 245 |
| 245 void MaximizeModeWindowManager::MaximizeAndTrackWindow(aura::Window* window) { | 246 void MaximizeModeWindowManager::MaximizeAndTrackWindow(aura::Window* window) { |
| 246 if (!ShouldHandleWindow(window)) | 247 if (!ShouldHandleWindow(window)) |
| 247 return; | 248 return; |
| 248 | 249 |
| 249 DCHECK(window_state_map_.find(window) == window_state_map_.end()); | 250 DCHECK(window_state_map_.find(window) == window_state_map_.end()); |
| 250 window->AddObserver(this); | 251 window->AddObserver(this); |
| 251 | 252 |
| 252 // We create and remember a maximize mode state which will attach itself to | 253 // We create and remember a maximize mode state which will attach itself to |
| 253 // the provided state object. | 254 // the provided state object. |
| 254 window_state_map_[window] = new MaximizeModeWindowState(window, this); | 255 window_state_map_[window] = |
| 256 new MaximizeModeWindowState(WmWindowAura::Get(window), this); |
| 255 } | 257 } |
| 256 | 258 |
| 257 void MaximizeModeWindowManager::ForgetWindow(aura::Window* window) { | 259 void MaximizeModeWindowManager::ForgetWindow(aura::Window* window) { |
| 258 WindowToState::iterator it = window_state_map_.find(window); | 260 WindowToState::iterator it = window_state_map_.find(window); |
| 259 | 261 |
| 260 // The following DCHECK could fail if our window state object was destroyed | 262 // The following DCHECK could fail if our window state object was destroyed |
| 261 // earlier by someone else. However - at this point there is no other client | 263 // earlier by someone else. However - at this point there is no other client |
| 262 // which replaces the state object and therefore this should not happen. | 264 // which replaces the state object and therefore this should not happen. |
| 263 DCHECK(it != window_state_map_.end()); | 265 DCHECK(it != window_state_map_.end()); |
| 264 window->RemoveObserver(this); | 266 window->RemoveObserver(this); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // the topmost window of its container. | 338 // the topmost window of its container. |
| 337 Shell::RootWindowControllerList controllers = | 339 Shell::RootWindowControllerList controllers = |
| 338 Shell::GetAllRootWindowControllers(); | 340 Shell::GetAllRootWindowControllers(); |
| 339 for (Shell::RootWindowControllerList::iterator iter = controllers.begin(); | 341 for (Shell::RootWindowControllerList::iterator iter = controllers.begin(); |
| 340 iter != controllers.end(); ++iter) { | 342 iter != controllers.end(); ++iter) { |
| 341 RootWindowController* controller = *iter; | 343 RootWindowController* controller = *iter; |
| 342 aura::Window* container = Shell::GetContainer( | 344 aura::Window* container = Shell::GetContainer( |
| 343 controller->GetRootWindow(), kShellWindowId_DefaultContainer); | 345 controller->GetRootWindow(), kShellWindowId_DefaultContainer); |
| 344 controller->workspace_controller()->SetMaximizeBackdropDelegate( | 346 controller->workspace_controller()->SetMaximizeBackdropDelegate( |
| 345 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate>( | 347 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate>( |
| 346 enable ? new WorkspaceBackdropDelegate(container) : NULL)); | 348 enable ? new WorkspaceBackdropDelegate(WmWindowAura::Get(container)) |
| 349 : nullptr)); |
| 347 } | 350 } |
| 348 } | 351 } |
| 349 | 352 |
| 350 } // namespace ash | 353 } // namespace ash |
| OLD | NEW |