Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_window_manager.cc

Issue 2091263004: Moves a couple of the maximize mode classes to ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: deps Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 void MaximizeModeWindowManager::MaximizeAndTrackWindow( 247 void MaximizeModeWindowManager::MaximizeAndTrackWindow(
247 aura::Window* window) { 248 aura::Window* window) {
248 if (!ShouldHandleWindow(window)) 249 if (!ShouldHandleWindow(window))
249 return; 250 return;
250 251
251 DCHECK(window_state_map_.find(window) == window_state_map_.end()); 252 DCHECK(window_state_map_.find(window) == window_state_map_.end());
252 window->AddObserver(this); 253 window->AddObserver(this);
253 254
254 // We create and remember a maximize mode state which will attach itself to 255 // We create and remember a maximize mode state which will attach itself to
255 // the provided state object. 256 // the provided state object.
256 window_state_map_[window] = new MaximizeModeWindowState(window, this); 257 window_state_map_[window] =
258 new MaximizeModeWindowState(WmWindowAura::Get(window), this);
257 } 259 }
258 260
259 void MaximizeModeWindowManager::ForgetWindow(aura::Window* window) { 261 void MaximizeModeWindowManager::ForgetWindow(aura::Window* window) {
260 WindowToState::iterator it = window_state_map_.find(window); 262 WindowToState::iterator it = window_state_map_.find(window);
261 263
262 // The following DCHECK could fail if our window state object was destroyed 264 // The following DCHECK could fail if our window state object was destroyed
263 // earlier by someone else. However - at this point there is no other client 265 // earlier by someone else. However - at this point there is no other client
264 // which replaces the state object and therefore this should not happen. 266 // which replaces the state object and therefore this should not happen.
265 DCHECK(it != window_state_map_.end()); 267 DCHECK(it != window_state_map_.end());
266 window->RemoveObserver(this); 268 window->RemoveObserver(this);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // the topmost window of its container. 340 // the topmost window of its container.
339 Shell::RootWindowControllerList controllers = 341 Shell::RootWindowControllerList controllers =
340 Shell::GetAllRootWindowControllers(); 342 Shell::GetAllRootWindowControllers();
341 for (Shell::RootWindowControllerList::iterator iter = controllers.begin(); 343 for (Shell::RootWindowControllerList::iterator iter = controllers.begin();
342 iter != controllers.end(); ++iter) { 344 iter != controllers.end(); ++iter) {
343 RootWindowController* controller = *iter; 345 RootWindowController* controller = *iter;
344 aura::Window* container = Shell::GetContainer( 346 aura::Window* container = Shell::GetContainer(
345 controller->GetRootWindow(), kShellWindowId_DefaultContainer); 347 controller->GetRootWindow(), kShellWindowId_DefaultContainer);
346 controller->workspace_controller()->SetMaximizeBackdropDelegate( 348 controller->workspace_controller()->SetMaximizeBackdropDelegate(
347 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate>( 349 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate>(
348 enable ? new WorkspaceBackdropDelegate(container) : NULL)); 350 enable ? new WorkspaceBackdropDelegate(WmWindowAura::Get(container))
351 : nullptr));
349 } 352 }
350 } 353 }
351 354
352 } // namespace ash 355 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698