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

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

Powered by Google App Engine
This is Rietveld 408576698