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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 1841803002: Cleanup WorkspaceController and WorkspaceLayoutManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check if the container is kShellWindowId_DefaultContainer instead. Created 4 years, 8 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
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.h ('k') | ash/wm/workspace_controller.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
11 #include "ash/session/session_state_delegate.h" 11 #include "ash/session/session_state_delegate.h"
12 #include "ash/shelf/shelf_layout_manager.h"
13 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/shell_window_ids.h"
14 #include "ash/wm/always_on_top_controller.h" 14 #include "ash/wm/always_on_top_controller.h"
15 #include "ash/wm/window_animations.h" 15 #include "ash/wm/window_animations.h"
16 #include "ash/wm/window_positioner.h" 16 #include "ash/wm/window_positioner.h"
17 #include "ash/wm/window_properties.h" 17 #include "ash/wm/window_properties.h"
18 #include "ash/wm/window_state.h" 18 #include "ash/wm/window_state.h"
19 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
20 #include "ash/wm/wm_event.h" 20 #include "ash/wm/wm_event.h"
21 #include "ash/wm/workspace/workspace_layout_manager_delegate.h" 21 #include "ash/wm/workspace/workspace_layout_manager_delegate.h"
22 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
23 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
24 #include "ui/aura/window_observer.h" 24 #include "ui/aura/window_observer.h"
25 #include "ui/base/ui_base_types.h" 25 #include "ui/base/ui_base_types.h"
26 #include "ui/compositor/layer.h" 26 #include "ui/compositor/layer.h"
27 #include "ui/events/event.h" 27 #include "ui/events/event.h"
28 #include "ui/gfx/screen.h" 28 #include "ui/gfx/screen.h"
29 #include "ui/keyboard/keyboard_controller_observer.h" 29 #include "ui/keyboard/keyboard_controller_observer.h"
30 #include "ui/wm/core/window_util.h" 30 #include "ui/wm/core/window_util.h"
31 #include "ui/wm/public/activation_client.h" 31 #include "ui/wm/public/activation_client.h"
32 32
33 using aura::Window;
34
35 namespace ash { 33 namespace ash {
36 34
37 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) 35 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window)
38 : shelf_(NULL), 36 : window_(window),
39 window_(window), 37 root_window_(window_->GetRootWindow()),
40 root_window_(window->GetRootWindow()), 38 root_window_controller_(GetRootWindowController(root_window_)),
41 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen( 39 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen(
42 window_, 40 window_,
43 gfx::Screen::GetScreen() 41 gfx::Screen::GetScreen()
44 ->GetDisplayNearestWindow(window_) 42 ->GetDisplayNearestWindow(window_)
45 .work_area())), 43 .work_area())),
46 is_fullscreen_(GetRootWindowController(window->GetRootWindow()) 44 is_fullscreen_(root_window_controller_->GetWindowForFullscreenMode() !=
47 ->GetWindowForFullscreenMode() != NULL) { 45 nullptr) {
48 Shell::GetInstance()->activation_client()->AddObserver(this); 46 Shell::GetInstance()->activation_client()->AddObserver(this);
49 Shell::GetInstance()->AddShellObserver(this); 47 Shell::GetInstance()->AddShellObserver(this);
50 root_window_->AddObserver(this); 48 root_window_->AddObserver(this);
51 DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary)); 49 DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary));
52 } 50 }
53 51
54 WorkspaceLayoutManager::~WorkspaceLayoutManager() { 52 WorkspaceLayoutManager::~WorkspaceLayoutManager() {
55 if (root_window_) 53 if (root_window_)
56 root_window_->RemoveObserver(this); 54 root_window_->RemoveObserver(this);
57 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) 55 for (auto* window : windows_)
58 (*i)->RemoveObserver(this); 56 window->RemoveObserver(this);
59 Shell::GetInstance()->RemoveShellObserver(this); 57 Shell::GetInstance()->RemoveShellObserver(this);
60 Shell::GetInstance()->activation_client()->RemoveObserver(this); 58 Shell::GetInstance()->activation_client()->RemoveObserver(this);
61 } 59 }
62 60
63 void WorkspaceLayoutManager::SetShelf(ShelfLayoutManager* shelf) {
64 shelf_ = shelf;
65 }
66
67 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate( 61 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate(
68 std::unique_ptr<WorkspaceLayoutManagerDelegate> delegate) { 62 std::unique_ptr<WorkspaceLayoutManagerDelegate> delegate) {
69 backdrop_delegate_.reset(delegate.release()); 63 backdrop_delegate_.reset(delegate.release());
70 } 64 }
71 65
72 ////////////////////////////////////////////////////////////////////////////// 66 //////////////////////////////////////////////////////////////////////////////
73 // WorkspaceLayoutManager, aura::LayoutManager implementation: 67 // WorkspaceLayoutManager, aura::LayoutManager implementation:
74 68
75 void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) { 69 void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
76 wm::WindowState* window_state = wm::GetWindowState(child); 70 wm::WindowState* window_state = wm::GetWindowState(child);
77 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE); 71 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE);
78 window_state->OnWMEvent(&event); 72 window_state->OnWMEvent(&event);
79 windows_.insert(child); 73 windows_.insert(child);
80 child->AddObserver(this); 74 child->AddObserver(this);
81 window_state->AddObserver(this); 75 window_state->AddObserver(this);
82 UpdateShelfVisibility(); 76 root_window_controller_->UpdateShelfVisibility();
83 UpdateFullscreenState(); 77 UpdateFullscreenState();
84 if (backdrop_delegate_) 78 if (backdrop_delegate_)
85 backdrop_delegate_->OnWindowAddedToLayout(child); 79 backdrop_delegate_->OnWindowAddedToLayout(child);
86 WindowPositioner::RearrangeVisibleWindowOnShow(child); 80 WindowPositioner::RearrangeVisibleWindowOnShow(child);
87 } 81 }
88 82
89 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(Window* child) { 83 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
90 windows_.erase(child); 84 windows_.erase(child);
91 child->RemoveObserver(this); 85 child->RemoveObserver(this);
92 wm::GetWindowState(child)->RemoveObserver(this); 86 wm::GetWindowState(child)->RemoveObserver(this);
93 87
94 if (child->TargetVisibility()) 88 if (child->TargetVisibility())
95 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); 89 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child);
96 } 90 }
97 91
98 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(Window* child) { 92 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
99 UpdateShelfVisibility(); 93 root_window_controller_->UpdateShelfVisibility();
100 UpdateFullscreenState(); 94 UpdateFullscreenState();
101 if (backdrop_delegate_) 95 if (backdrop_delegate_)
102 backdrop_delegate_->OnWindowRemovedFromLayout(child); 96 backdrop_delegate_->OnWindowRemovedFromLayout(child);
103 } 97 }
104 98
105 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child, 99 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
106 bool visible) { 100 bool visible) {
107 wm::WindowState* window_state = wm::GetWindowState(child); 101 wm::WindowState* window_state = wm::GetWindowState(child);
108 // Attempting to show a minimized window. Unminimize it. 102 // Attempting to show a minimized window. Unminimize it.
109 if (visible && window_state->IsMinimized()) 103 if (visible && window_state->IsMinimized())
110 window_state->Unminimize(); 104 window_state->Unminimize();
111 105
112 if (child->TargetVisibility()) 106 if (child->TargetVisibility())
113 WindowPositioner::RearrangeVisibleWindowOnShow(child); 107 WindowPositioner::RearrangeVisibleWindowOnShow(child);
114 else 108 else
115 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); 109 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child);
116 UpdateFullscreenState(); 110 UpdateFullscreenState();
117 UpdateShelfVisibility(); 111 root_window_controller_->UpdateShelfVisibility();
118 if (backdrop_delegate_) 112 if (backdrop_delegate_)
119 backdrop_delegate_->OnChildWindowVisibilityChanged(child, visible); 113 backdrop_delegate_->OnChildWindowVisibilityChanged(child, visible);
120 } 114 }
121 115
122 void WorkspaceLayoutManager::SetChildBounds( 116 void WorkspaceLayoutManager::SetChildBounds(aura::Window* child,
123 Window* child, 117 const gfx::Rect& requested_bounds) {
124 const gfx::Rect& requested_bounds) {
125 wm::WindowState* window_state = wm::GetWindowState(child); 118 wm::WindowState* window_state = wm::GetWindowState(child);
126 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds); 119 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds);
127 window_state->OnWMEvent(&event); 120 window_state->OnWMEvent(&event);
128 UpdateShelfVisibility(); 121 root_window_controller_->UpdateShelfVisibility();
129 } 122 }
130 123
131 ////////////////////////////////////////////////////////////////////////////// 124 //////////////////////////////////////////////////////////////////////////////
132 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation: 125 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation:
133 126
134 void WorkspaceLayoutManager::OnKeyboardBoundsChanging( 127 void WorkspaceLayoutManager::OnKeyboardBoundsChanging(
135 const gfx::Rect& new_bounds) { 128 const gfx::Rect& new_bounds) {
136 aura::Window* window = wm::GetActiveWindow()->GetToplevelWindow(); 129 aura::Window* window = wm::GetActiveWindow()->GetToplevelWindow();
137 if (!window || !window_->Contains(window)) 130 if (!window || !window_->Contains(window))
138 return; 131 return;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 167 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
175 AdjustAllWindowsBoundsForWorkAreaChange(&event); 168 AdjustAllWindowsBoundsForWorkAreaChange(&event);
176 } 169 }
177 if (backdrop_delegate_) 170 if (backdrop_delegate_)
178 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged(); 171 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged();
179 } 172 }
180 173
181 void WorkspaceLayoutManager::OnFullscreenStateChanged( 174 void WorkspaceLayoutManager::OnFullscreenStateChanged(
182 bool is_fullscreen, 175 bool is_fullscreen,
183 aura::Window* root_window) { 176 aura::Window* root_window) {
184 if (window_->GetRootWindow() != root_window || 177 if (root_window_ != root_window || is_fullscreen_ == is_fullscreen)
185 is_fullscreen_ == is_fullscreen) {
186 return; 178 return;
187 }
188 is_fullscreen_ = is_fullscreen; 179 is_fullscreen_ = is_fullscreen;
189 Window* fullscreen_window = 180 aura::Window* fullscreen_window =
190 is_fullscreen 181 is_fullscreen ? root_window_controller_->GetWindowForFullscreenMode()
191 ? GetRootWindowController(window_->GetRootWindow()) 182 : nullptr;
192 ->GetWindowForFullscreenMode()
193 : NULL;
194 // Changing always on top state may change window's parent. Iterate on a copy 183 // Changing always on top state may change window's parent. Iterate on a copy
195 // of |windows_| to avoid invalidating an iterator. Since both workspace and 184 // of |windows_| to avoid invalidating an iterator. Since both workspace and
196 // always_on_top containers' layouts are managed by this class all the 185 // always_on_top containers' layouts are managed by this class all the
197 // appropriate windows will be included in the iteration. 186 // appropriate windows will be included in the iteration.
198 WindowSet windows(windows_); 187 WindowSet windows(windows_);
199 for (auto window : windows) { 188 for (auto* window : windows) {
200 wm::WindowState* window_state = wm::GetWindowState(window); 189 wm::WindowState* window_state = wm::GetWindowState(window);
201 if (is_fullscreen) 190 if (is_fullscreen)
202 window_state->DisableAlwaysOnTop(fullscreen_window); 191 window_state->DisableAlwaysOnTop(fullscreen_window);
203 else 192 else
204 window_state->RestoreAlwaysOnTop(); 193 window_state->RestoreAlwaysOnTop();
205 } 194 }
206 } 195 }
207 196
208 ////////////////////////////////////////////////////////////////////////////// 197 //////////////////////////////////////////////////////////////////////////////
209 // WorkspaceLayoutManager, aura::WindowObserver implementation: 198 // WorkspaceLayoutManager, aura::WindowObserver implementation:
210 199
211 void WorkspaceLayoutManager::OnWindowHierarchyChanged( 200 void WorkspaceLayoutManager::OnWindowHierarchyChanged(
212 const WindowObserver::HierarchyChangeParams& params) { 201 const WindowObserver::HierarchyChangeParams& params) {
213 if (!wm::GetWindowState(params.target)->IsActive()) 202 if (!wm::GetWindowState(params.target)->IsActive())
214 return; 203 return;
215 // If the window is already tracked by the workspace this update would be 204 // If the window is already tracked by the workspace this update would be
216 // redundant as the fullscreen and shelf state would have been handled in 205 // redundant as the fullscreen and shelf state would have been handled in
217 // OnWindowAddedToLayout. 206 // OnWindowAddedToLayout.
218 if (windows_.find(params.target) != windows_.end()) 207 if (windows_.find(params.target) != windows_.end())
219 return; 208 return;
220 209
221 // If the active window has moved to this root window then update the 210 // If the active window has moved to this root window then update the
222 // fullscreen state. 211 // fullscreen state.
223 // TODO(flackr): Track the active window leaving this root window and update 212 // TODO(flackr): Track the active window leaving this root window and update
224 // the fullscreen state accordingly. 213 // the fullscreen state accordingly.
225 if (params.new_parent && params.new_parent->GetRootWindow() == root_window_) { 214 if (params.new_parent && params.new_parent->GetRootWindow() == root_window_) {
226 UpdateFullscreenState(); 215 UpdateFullscreenState();
227 UpdateShelfVisibility(); 216 root_window_controller_->UpdateShelfVisibility();
228 } 217 }
229 } 218 }
230 219
231 void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window, 220 void WorkspaceLayoutManager::OnWindowPropertyChanged(aura::Window* window,
232 const void* key, 221 const void* key,
233 intptr_t old) { 222 intptr_t old) {
234 if (key == aura::client::kAlwaysOnTopKey && 223 if (key == aura::client::kAlwaysOnTopKey &&
235 window->GetProperty(aura::client::kAlwaysOnTopKey)) { 224 window->GetProperty(aura::client::kAlwaysOnTopKey)) {
236 GetRootWindowController(window->GetRootWindow())-> 225 GetRootWindowController(window->GetRootWindow())->
237 always_on_top_controller()->GetContainer(window)->AddChild(window); 226 always_on_top_controller()->GetContainer(window)->AddChild(window);
238 } 227 }
239 } 228 }
240 229
241 void WorkspaceLayoutManager::OnWindowStackingChanged(aura::Window* window) { 230 void WorkspaceLayoutManager::OnWindowStackingChanged(aura::Window* window) {
242 UpdateShelfVisibility(); 231 root_window_controller_->UpdateShelfVisibility();
243 UpdateFullscreenState(); 232 UpdateFullscreenState();
244 if (backdrop_delegate_) 233 if (backdrop_delegate_)
245 backdrop_delegate_->OnWindowStackingChanged(window); 234 backdrop_delegate_->OnWindowStackingChanged(window);
246 } 235 }
247 236
248 void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) { 237 void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) {
249 if (root_window_ == window) { 238 if (root_window_ == window) {
250 root_window_->RemoveObserver(this); 239 root_window_->RemoveObserver(this);
251 root_window_ = NULL; 240 root_window_ = nullptr;
241 root_window_controller_ = nullptr;
252 } 242 }
253 } 243 }
254 244
255 void WorkspaceLayoutManager::OnWindowBoundsChanged(aura::Window* window, 245 void WorkspaceLayoutManager::OnWindowBoundsChanged(
256 const gfx::Rect& old_bounds, 246 aura::Window* window,
257 const gfx::Rect& new_bounds) { 247 const gfx::Rect& old_bounds,
248 const gfx::Rect& new_bounds) {
258 if (root_window_ == window) { 249 if (root_window_ == window) {
259 const wm::WMEvent wm_event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED); 250 const wm::WMEvent wm_event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED);
260 AdjustAllWindowsBoundsForWorkAreaChange(&wm_event); 251 AdjustAllWindowsBoundsForWorkAreaChange(&wm_event);
261 } 252 }
262 } 253 }
263 254
264 ////////////////////////////////////////////////////////////////////////////// 255 //////////////////////////////////////////////////////////////////////////////
265 // WorkspaceLayoutManager, 256 // WorkspaceLayoutManager,
266 // aura::client::ActivationChangeObserver implementation: 257 // aura::client::ActivationChangeObserver implementation:
267 258
268 void WorkspaceLayoutManager::OnWindowActivated( 259 void WorkspaceLayoutManager::OnWindowActivated(
269 aura::client::ActivationChangeObserver::ActivationReason reason, 260 aura::client::ActivationChangeObserver::ActivationReason reason,
270 aura::Window* gained_active, 261 aura::Window* gained_active,
271 aura::Window* lost_active) { 262 aura::Window* lost_active) {
272 wm::WindowState* window_state = wm::GetWindowState(gained_active); 263 wm::WindowState* window_state = wm::GetWindowState(gained_active);
273 if (window_state && window_state->IsMinimized() && 264 if (window_state && window_state->IsMinimized() &&
274 !gained_active->IsVisible()) { 265 !gained_active->IsVisible()) {
275 window_state->Unminimize(); 266 window_state->Unminimize();
276 DCHECK(!window_state->IsMinimized()); 267 DCHECK(!window_state->IsMinimized());
277 } 268 }
278 UpdateFullscreenState(); 269 UpdateFullscreenState();
279 UpdateShelfVisibility(); 270 root_window_controller_->UpdateShelfVisibility();
280 } 271 }
281 272
282 ////////////////////////////////////////////////////////////////////////////// 273 //////////////////////////////////////////////////////////////////////////////
283 // WorkspaceLayoutManager, wm::WindowStateObserver implementation: 274 // WorkspaceLayoutManager, wm::WindowStateObserver implementation:
284 275
285 void WorkspaceLayoutManager::OnPostWindowStateTypeChange( 276 void WorkspaceLayoutManager::OnPostWindowStateTypeChange(
286 wm::WindowState* window_state, 277 wm::WindowState* window_state,
287 wm::WindowStateType old_type) { 278 wm::WindowStateType old_type) {
288 279
289 // Notify observers that fullscreen state may be changing. 280 // Notify observers that fullscreen state may be changing.
290 if (window_state->IsFullscreen() || 281 if (window_state->IsFullscreen() ||
291 old_type == wm::WINDOW_STATE_TYPE_FULLSCREEN) { 282 old_type == wm::WINDOW_STATE_TYPE_FULLSCREEN) {
292 UpdateFullscreenState(); 283 UpdateFullscreenState();
293 } 284 }
294 285
295 UpdateShelfVisibility(); 286 root_window_controller_->UpdateShelfVisibility();
296 if (backdrop_delegate_) 287 if (backdrop_delegate_)
297 backdrop_delegate_->OnPostWindowStateTypeChange(window_state, old_type); 288 backdrop_delegate_->OnPostWindowStateTypeChange(window_state, old_type);
298 } 289 }
299 290
300 ////////////////////////////////////////////////////////////////////////////// 291 //////////////////////////////////////////////////////////////////////////////
301 // WorkspaceLayoutManager, private: 292 // WorkspaceLayoutManager, private:
302 293
303 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange( 294 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange(
304 const wm::WMEvent* event) { 295 const wm::WMEvent* event) {
305 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || 296 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED ||
306 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 297 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
307 298
308 work_area_in_parent_ = ScreenUtil::ConvertRectFromScreen( 299 work_area_in_parent_ = ScreenUtil::ConvertRectFromScreen(
309 window_, 300 window_,
310 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_).work_area()); 301 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_).work_area());
311 302
312 // Don't do any adjustments of the insets while we are in screen locked mode. 303 // Don't do any adjustments of the insets while we are in screen locked mode.
313 // This would happen if the launcher was auto hidden before the login screen 304 // This would happen if the launcher was auto hidden before the login screen
314 // was shown and then gets shown when the login screen gets presented. 305 // was shown and then gets shown when the login screen gets presented.
315 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED && 306 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED &&
316 Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) 307 Shell::GetInstance()->session_state_delegate()->IsScreenLocked())
317 return; 308 return;
318 309
319 // If a user plugs an external display into a laptop running Aura the 310 // If a user plugs an external display into a laptop running Aura the
320 // display size will change. Maximized windows need to resize to match. 311 // display size will change. Maximized windows need to resize to match.
321 // We also do this when developers running Aura on a desktop manually resize 312 // We also do this when developers running Aura on a desktop manually resize
322 // the host window. 313 // the host window.
323 // We also need to do this when the work area insets changes. 314 // We also need to do this when the work area insets changes.
324 for (WindowSet::const_iterator it = windows_.begin(); 315 for (auto* window : windows_)
325 it != windows_.end(); 316 wm::GetWindowState(window)->OnWMEvent(event);
326 ++it) {
327 wm::GetWindowState(*it)->OnWMEvent(event);
328 }
329 }
330
331 void WorkspaceLayoutManager::UpdateShelfVisibility() {
332 if (shelf_)
333 shelf_->UpdateVisibilityState();
334 } 317 }
335 318
336 void WorkspaceLayoutManager::UpdateFullscreenState() { 319 void WorkspaceLayoutManager::UpdateFullscreenState() {
337 // TODO(flackr): The fullscreen state is currently tracked per workspace 320 // TODO(flackr): The fullscreen state is currently tracked per workspace
338 // but the shell notification implies a per root window state. Currently 321 // but the shell notification implies a per root window state. Currently
339 // only windows in the default workspace container will go fullscreen but 322 // only windows in the default workspace container will go fullscreen but
340 // this should really be tracked by the RootWindowController since 323 // this should really be tracked by the RootWindowController since
341 // technically any container could get a fullscreen window. 324 // technically any container could get a fullscreen window.
342 if (!shelf_) 325 if (window_->id() != kShellWindowId_DefaultContainer)
343 return; 326 return;
344 bool is_fullscreen = GetRootWindowController( 327 bool is_fullscreen =
345 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; 328 root_window_controller_->GetWindowForFullscreenMode() != nullptr;
346 if (is_fullscreen != is_fullscreen_) { 329 if (is_fullscreen != is_fullscreen_) {
347 ash::Shell::GetInstance()->NotifyFullscreenStateChange( 330 ash::Shell::GetInstance()->NotifyFullscreenStateChange(is_fullscreen,
348 is_fullscreen, window_->GetRootWindow()); 331 root_window_);
349 is_fullscreen_ = is_fullscreen; 332 is_fullscreen_ = is_fullscreen;
350 } 333 }
351 } 334 }
352 335
353 } // namespace ash 336 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.h ('k') | ash/wm/workspace_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698