OLD | NEW |
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/keyboard/keyboard_observer_register.h" | 9 #include "ash/keyboard/keyboard_observer_register.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_)); | 297 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_)); |
298 if (work_area != work_area_in_parent_) { | 298 if (work_area != work_area_in_parent_) { |
299 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 299 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
300 AdjustAllWindowsBoundsForWorkAreaChange(&event); | 300 AdjustAllWindowsBoundsForWorkAreaChange(&event); |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 ////////////////////////////////////////////////////////////////////////////// | 304 ////////////////////////////////////////////////////////////////////////////// |
305 // WorkspaceLayoutManager, ShellObserver implementation: | 305 // WorkspaceLayoutManager, ShellObserver implementation: |
306 | 306 |
307 void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen, | 307 void WorkspaceLayoutManager::OnFullscreenStateChanged( |
308 WmWindow* root_window) { | 308 bool is_fullscreen, |
309 if (root_window->aura_window() != root_window_ || | 309 aura::Window* root_window) { |
310 is_fullscreen_ == is_fullscreen) { | 310 if (root_window != root_window_ || is_fullscreen_ == is_fullscreen) |
311 return; | 311 return; |
312 } | |
313 | 312 |
314 is_fullscreen_ = is_fullscreen; | 313 is_fullscreen_ = is_fullscreen; |
315 if (Shell::Get()->screen_pinning_controller()->IsPinned()) { | 314 if (Shell::Get()->screen_pinning_controller()->IsPinned()) { |
316 // If this is in pinned mode, then this event does not trigger the | 315 // If this is in pinned mode, then this event does not trigger the |
317 // always-on-top state change, because it is kept disabled regardless of | 316 // always-on-top state change, because it is kept disabled regardless of |
318 // the fullscreen state change. | 317 // the fullscreen state change. |
319 return; | 318 return; |
320 } | 319 } |
321 | 320 |
322 UpdateAlwaysOnTop(is_fullscreen_ ? wm::GetWindowForFullscreenMode(window_) | 321 UpdateAlwaysOnTop(is_fullscreen_ ? wm::GetWindowForFullscreenMode(window_) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 void WorkspaceLayoutManager::UpdateFullscreenState() { | 375 void WorkspaceLayoutManager::UpdateFullscreenState() { |
377 // TODO(flackr): The fullscreen state is currently tracked per workspace | 376 // TODO(flackr): The fullscreen state is currently tracked per workspace |
378 // but the shell notification implies a per root window state. Currently | 377 // but the shell notification implies a per root window state. Currently |
379 // only windows in the default workspace container will go fullscreen but | 378 // only windows in the default workspace container will go fullscreen but |
380 // this should really be tracked by the RootWindowController since | 379 // this should really be tracked by the RootWindowController since |
381 // technically any container could get a fullscreen window. | 380 // technically any container could get a fullscreen window. |
382 if (window_->id() != kShellWindowId_DefaultContainer) | 381 if (window_->id() != kShellWindowId_DefaultContainer) |
383 return; | 382 return; |
384 bool is_fullscreen = wm::GetWindowForFullscreenMode(window_) != nullptr; | 383 bool is_fullscreen = wm::GetWindowForFullscreenMode(window_) != nullptr; |
385 if (is_fullscreen != is_fullscreen_) { | 384 if (is_fullscreen != is_fullscreen_) { |
386 Shell::Get()->NotifyFullscreenStateChanged(is_fullscreen, | 385 Shell::Get()->NotifyFullscreenStateChanged(is_fullscreen, root_window_); |
387 WmWindow::Get(root_window_)); | |
388 is_fullscreen_ = is_fullscreen; | 386 is_fullscreen_ = is_fullscreen; |
389 } | 387 } |
390 } | 388 } |
391 | 389 |
392 void WorkspaceLayoutManager::UpdateAlwaysOnTop(aura::Window* window_on_top) { | 390 void WorkspaceLayoutManager::UpdateAlwaysOnTop(aura::Window* window_on_top) { |
393 // Changing always on top state may change window's parent. Iterate on a copy | 391 // Changing always on top state may change window's parent. Iterate on a copy |
394 // of |windows_| to avoid invalidating an iterator. Since both workspace and | 392 // of |windows_| to avoid invalidating an iterator. Since both workspace and |
395 // always_on_top containers' layouts are managed by this class all the | 393 // always_on_top containers' layouts are managed by this class all the |
396 // appropriate windows will be included in the iteration. | 394 // appropriate windows will be included in the iteration. |
397 WindowSet windows(windows_); | 395 WindowSet windows(windows_); |
398 for (aura::Window* window : windows) { | 396 for (aura::Window* window : windows) { |
399 wm::WindowState* window_state = wm::GetWindowState(window); | 397 wm::WindowState* window_state = wm::GetWindowState(window); |
400 if (window_on_top) | 398 if (window_on_top) |
401 window_state->DisableAlwaysOnTop(window_on_top); | 399 window_state->DisableAlwaysOnTop(window_on_top); |
402 else | 400 else |
403 window_state->RestoreAlwaysOnTop(); | 401 window_state->RestoreAlwaysOnTop(); |
404 } | 402 } |
405 } | 403 } |
406 | 404 |
407 } // namespace ash | 405 } // namespace ash |
OLD | NEW |