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

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

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ash/wm/common/window_state.h" 11 #include "ash/wm/common/window_state.h"
12 #include "ash/wm/common/wm_event.h" 12 #include "ash/wm/common/wm_event.h"
13 #include "ash/wm/maximize_mode/maximize_mode_window_state.h" 13 #include "ash/wm/maximize_mode/maximize_mode_window_state.h"
14 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" 14 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h"
15 #include "ash/wm/mru_window_tracker.h" 15 #include "ash/wm/mru_window_tracker.h"
16 #include "ash/wm/overview/window_selector_controller.h" 16 #include "ash/wm/overview/window_selector_controller.h"
17 #include "ash/wm/window_state_aura.h" 17 #include "ash/wm/window_state_aura.h"
18 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
19 #include "ash/wm/workspace_controller.h" 19 #include "ash/wm/workspace_controller.h"
20 #include "base/command_line.h" 20 #include "base/command_line.h"
21 #include "ui/aura/client/aura_constants.h" 21 #include "ui/aura/client/aura_constants.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/gfx/screen.h" 23 #include "ui/display/screen.h"
24 24
25 namespace ash { 25 namespace ash {
26 26
27 namespace { 27 namespace {
28 28
29 // The height of the area in which a touch operation leads to exiting the 29 // The height of the area in which a touch operation leads to exiting the
30 // full screen mode. 30 // full screen mode.
31 const int kLeaveFullScreenAreaHeightInPixel = 2; 31 const int kLeaveFullScreenAreaHeightInPixel = 2;
32 32
33 // Exits overview mode if it is currently active. 33 // Exits overview mode if it is currently active.
34 void CancelOverview() { 34 void CancelOverview() {
35 WindowSelectorController* controller = 35 WindowSelectorController* controller =
36 Shell::GetInstance()->window_selector_controller(); 36 Shell::GetInstance()->window_selector_controller();
37 if (controller && controller->IsSelecting()) 37 if (controller && controller->IsSelecting())
38 controller->OnSelectionEnded(); 38 controller->OnSelectionEnded();
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 MaximizeModeWindowManager::~MaximizeModeWindowManager() { 43 MaximizeModeWindowManager::~MaximizeModeWindowManager() {
44 // Overview mode needs to be ended before exiting maximize mode to prevent 44 // Overview mode needs to be ended before exiting maximize mode to prevent
45 // transforming windows which are currently in 45 // transforming windows which are currently in
46 // overview: http://crbug.com/366605 46 // overview: http://crbug.com/366605
47 CancelOverview(); 47 CancelOverview();
48 48
49 Shell::GetInstance()->RemovePreTargetHandler(this); 49 Shell::GetInstance()->RemovePreTargetHandler(this);
50 Shell::GetInstance()->RemoveShellObserver(this); 50 Shell::GetInstance()->RemoveShellObserver(this);
51 gfx::Screen::GetScreen()->RemoveObserver(this); 51 display::Screen::GetScreen()->RemoveObserver(this);
52 EnableBackdropBehindTopWindowOnEachDisplay(false); 52 EnableBackdropBehindTopWindowOnEachDisplay(false);
53 RemoveWindowCreationObservers(); 53 RemoveWindowCreationObservers();
54 RestoreAllWindows(); 54 RestoreAllWindows();
55 } 55 }
56 56
57 int MaximizeModeWindowManager::GetNumberOfManagedWindows() { 57 int MaximizeModeWindowManager::GetNumberOfManagedWindows() {
58 return window_state_map_.size(); 58 return window_state_map_.size();
59 } 59 }
60 60
61 void MaximizeModeWindowManager::AddWindow(aura::Window* window) { 61 void MaximizeModeWindowManager::AddWindow(aura::Window* window) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (!IsContainerWindow(window)) 141 if (!IsContainerWindow(window))
142 return; 142 return;
143 // Reposition all non maximizeable windows. 143 // Reposition all non maximizeable windows.
144 for (WindowToState::iterator it = window_state_map_.begin(); 144 for (WindowToState::iterator it = window_state_map_.begin();
145 it != window_state_map_.end(); 145 it != window_state_map_.end();
146 ++it) { 146 ++it) {
147 it->second->UpdateWindowPosition(wm::GetWindowState(it->first)); 147 it->second->UpdateWindowPosition(wm::GetWindowState(it->first));
148 } 148 }
149 } 149 }
150 150
151 void MaximizeModeWindowManager::OnDisplayAdded(const gfx::Display& display) { 151 void MaximizeModeWindowManager::OnDisplayAdded(
152 const display::Display& display) {
152 DisplayConfigurationChanged(); 153 DisplayConfigurationChanged();
153 } 154 }
154 155
155 void MaximizeModeWindowManager::OnDisplayRemoved(const gfx::Display& display) { 156 void MaximizeModeWindowManager::OnDisplayRemoved(
157 const display::Display& display) {
156 DisplayConfigurationChanged(); 158 DisplayConfigurationChanged();
157 } 159 }
158 160
159 void MaximizeModeWindowManager::OnDisplayMetricsChanged(const gfx::Display&, 161 void MaximizeModeWindowManager::OnDisplayMetricsChanged(const display::Display&,
160 uint32_t) { 162 uint32_t) {
161 // Nothing to do here. 163 // Nothing to do here.
162 } 164 }
163 165
164 void MaximizeModeWindowManager::OnTouchEvent(ui::TouchEvent* event) { 166 void MaximizeModeWindowManager::OnTouchEvent(ui::TouchEvent* event) {
165 if (event->type() != ui::ET_TOUCH_PRESSED) 167 if (event->type() != ui::ET_TOUCH_PRESSED)
166 return; 168 return;
167 169
168 // Find the active window (from the primary screen) to un-fullscreen. 170 // Find the active window (from the primary screen) to un-fullscreen.
169 aura::Window* window = wm::GetActiveWindow(); 171 aura::Window* window = wm::GetActiveWindow();
(...skipping 19 matching lines...) Expand all
189 191
190 MaximizeModeWindowManager::MaximizeModeWindowManager() 192 MaximizeModeWindowManager::MaximizeModeWindowManager()
191 : backdrops_hidden_(false) { 193 : backdrops_hidden_(false) {
192 // The overview mode needs to be ended before the maximize mode is started. To 194 // The overview mode needs to be ended before the maximize mode is started. To
193 // guarantee the proper order, it will be turned off from here. 195 // guarantee the proper order, it will be turned off from here.
194 CancelOverview(); 196 CancelOverview();
195 197
196 MaximizeAllWindows(); 198 MaximizeAllWindows();
197 AddWindowCreationObservers(); 199 AddWindowCreationObservers();
198 EnableBackdropBehindTopWindowOnEachDisplay(true); 200 EnableBackdropBehindTopWindowOnEachDisplay(true);
199 gfx::Screen::GetScreen()->AddObserver(this); 201 display::Screen::GetScreen()->AddObserver(this);
200 Shell::GetInstance()->AddShellObserver(this); 202 Shell::GetInstance()->AddShellObserver(this);
201 Shell::GetInstance()->AddPreTargetHandler(this); 203 Shell::GetInstance()->AddPreTargetHandler(this);
202 } 204 }
203 205
204 void MaximizeModeWindowManager::MaximizeAllWindows() { 206 void MaximizeModeWindowManager::MaximizeAllWindows() {
205 MruWindowTracker::WindowList windows = ash::Shell::GetInstance()-> 207 MruWindowTracker::WindowList windows = ash::Shell::GetInstance()->
206 mru_window_tracker()->BuildWindowListIgnoreModal(); 208 mru_window_tracker()->BuildWindowListIgnoreModal();
207 // Add all existing Mru windows. 209 // Add all existing Mru windows.
208 for (MruWindowTracker::WindowList::iterator window = windows.begin(); 210 for (MruWindowTracker::WindowList::iterator window = windows.begin();
209 window != windows.end(); ++window) { 211 window != windows.end(); ++window) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 RootWindowController* controller = *iter; 327 RootWindowController* controller = *iter;
326 aura::Window* container = Shell::GetContainer( 328 aura::Window* container = Shell::GetContainer(
327 controller->GetRootWindow(), kShellWindowId_DefaultContainer); 329 controller->GetRootWindow(), kShellWindowId_DefaultContainer);
328 controller->workspace_controller()->SetMaximizeBackdropDelegate( 330 controller->workspace_controller()->SetMaximizeBackdropDelegate(
329 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate>( 331 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate>(
330 enable ? new WorkspaceBackdropDelegate(container) : NULL)); 332 enable ? new WorkspaceBackdropDelegate(container) : NULL));
331 } 333 }
332 } 334 }
333 335
334 } // namespace ash 336 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_window_manager.h ('k') | 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