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

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

Issue 262433002: Exit overview before exiting maximize mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create utility function to cancel overview. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/wm_event.h" 14 #include "ash/wm/wm_event.h"
15 #include "ash/wm/workspace_controller.h" 15 #include "ash/wm/workspace_controller.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/gfx/screen.h" 17 #include "ui/gfx/screen.h"
18 18
19 namespace ash { 19 namespace ash {
20 20
21 namespace {
22
23 // Exits overview mode if it is currently active.
24 void CancelOverview() {
25 WindowSelectorController* controller =
26 Shell::GetInstance()->window_selector_controller();
27 if (controller && controller->IsSelecting())
28 controller->OnSelectionCanceled();
29 }
30
31 } // namespace
32
21 MaximizeModeWindowManager::~MaximizeModeWindowManager() { 33 MaximizeModeWindowManager::~MaximizeModeWindowManager() {
34 // Overview mode needs to be ended before exiting maximize mode to prevent
35 // transforming windows which are currently in
36 // overview: http://crbug.com/366605
37 CancelOverview();
38
22 Shell::GetInstance()->RemoveShellObserver(this); 39 Shell::GetInstance()->RemoveShellObserver(this);
23 Shell::GetScreen()->RemoveObserver(this); 40 Shell::GetScreen()->RemoveObserver(this);
24 EnableBackdropBehindTopWindowOnEachDisplay(false); 41 EnableBackdropBehindTopWindowOnEachDisplay(false);
25 RemoveWindowCreationObservers(); 42 RemoveWindowCreationObservers();
26 RestoreAllWindows(); 43 RestoreAllWindows();
27 Shell::GetInstance()->OnMaximizeModeEnded(); 44 Shell::GetInstance()->OnMaximizeModeEnded();
28 } 45 }
29 46
30 int MaximizeModeWindowManager::GetNumberOfManagedWindows() { 47 int MaximizeModeWindowManager::GetNumberOfManagedWindows() {
31 return window_state_map_.size(); 48 return window_state_map_.size();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 118 }
102 119
103 void MaximizeModeWindowManager::OnDisplayRemoved(const gfx::Display& display) { 120 void MaximizeModeWindowManager::OnDisplayRemoved(const gfx::Display& display) {
104 DisplayConfigurationChanged(); 121 DisplayConfigurationChanged();
105 } 122 }
106 123
107 MaximizeModeWindowManager::MaximizeModeWindowManager() 124 MaximizeModeWindowManager::MaximizeModeWindowManager()
108 : backdrops_hidden_(false) { 125 : backdrops_hidden_(false) {
109 // The overview mode needs to be ended before the maximize mode is started. To 126 // The overview mode needs to be ended before the maximize mode is started. To
110 // guarantee the proper order, it will be turned off from here. 127 // guarantee the proper order, it will be turned off from here.
111 WindowSelectorController* controller = 128 CancelOverview();
112 Shell::GetInstance()->window_selector_controller();
113 if (controller && controller->IsSelecting())
114 controller->OnSelectionCanceled();
115 129
116 MaximizeAllWindows(); 130 MaximizeAllWindows();
117 AddWindowCreationObservers(); 131 AddWindowCreationObservers();
118 EnableBackdropBehindTopWindowOnEachDisplay(true); 132 EnableBackdropBehindTopWindowOnEachDisplay(true);
119 Shell::GetInstance()->OnMaximizeModeStarted(); 133 Shell::GetInstance()->OnMaximizeModeStarted();
120 Shell::GetScreen()->AddObserver(this); 134 Shell::GetScreen()->AddObserver(this);
121 Shell::GetInstance()->AddShellObserver(this); 135 Shell::GetInstance()->AddShellObserver(this);
122 } 136 }
123 137
124 void MaximizeModeWindowManager::MaximizeAllWindows() { 138 void MaximizeModeWindowManager::MaximizeAllWindows() {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 RootWindowController* controller = *iter; 233 RootWindowController* controller = *iter;
220 aura::Window* container = Shell::GetContainer( 234 aura::Window* container = Shell::GetContainer(
221 controller->GetRootWindow(), kShellWindowId_DefaultContainer); 235 controller->GetRootWindow(), kShellWindowId_DefaultContainer);
222 controller->workspace_controller()->SetMaximizeBackdropDelegate( 236 controller->workspace_controller()->SetMaximizeBackdropDelegate(
223 scoped_ptr<WorkspaceLayoutManagerDelegate>( 237 scoped_ptr<WorkspaceLayoutManagerDelegate>(
224 enable ? new WorkspaceBackdropDelegate(container) : NULL)); 238 enable ? new WorkspaceBackdropDelegate(container) : NULL));
225 } 239 }
226 } 240 }
227 241
228 } // namespace ash 242 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698