| 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/common/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wm/always_on_top_controller.h" | 11 #include "ash/common/wm/always_on_top_controller.h" |
| 12 #include "ash/common/wm/fullscreen_window_finder.h" | 12 #include "ash/common/wm/fullscreen_window_finder.h" |
| 13 #include "ash/common/wm/window_positioner.h" | 13 #include "ash/common/wm/window_positioner.h" |
| 14 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
| 15 #include "ash/common/wm/wm_event.h" | 15 #include "ash/common/wm/wm_event.h" |
| 16 #include "ash/common/wm/wm_screen_util.h" | 16 #include "ash/common/wm/wm_screen_util.h" |
| 17 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" | 17 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" |
| 18 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 19 #include "ash/common/wm_window.h" | 19 #include "ash/common/wm_window.h" |
| 20 #include "ash/common/wm_window_property.h" | |
| 21 #include "ash/public/cpp/shell_window_ids.h" | 20 #include "ash/public/cpp/shell_window_ids.h" |
| 22 #include "ash/root_window_controller.h" | 21 #include "ash/root_window_controller.h" |
| 22 #include "ash/wm/window_properties.h" |
| 23 #include "ash/wm/window_state_aura.h" | 23 #include "ash/wm/window_state_aura.h" |
| 24 #include "base/command_line.h" | 24 #include "base/command_line.h" |
| 25 #include "ui/aura/client/aura_constants.h" | 25 #include "ui/aura/client/aura_constants.h" |
| 26 #include "ui/base/ui_base_switches.h" | 26 #include "ui/base/ui_base_switches.h" |
| 27 #include "ui/compositor/layer.h" | 27 #include "ui/compositor/layer.h" |
| 28 #include "ui/display/display.h" | 28 #include "ui/display/display.h" |
| 29 #include "ui/display/screen.h" | 29 #include "ui/display/screen.h" |
| 30 #include "ui/keyboard/keyboard_controller.h" | 30 #include "ui/keyboard/keyboard_controller.h" |
| 31 #include "ui/keyboard/keyboard_controller_observer.h" | 31 #include "ui/keyboard/keyboard_controller_observer.h" |
| 32 | 32 |
| 33 namespace ash { | 33 namespace ash { |
| 34 | 34 |
| 35 WorkspaceLayoutManager::WorkspaceLayoutManager(WmWindow* window) | 35 WorkspaceLayoutManager::WorkspaceLayoutManager(WmWindow* window) |
| 36 : window_(window), | 36 : window_(window), |
| 37 root_window_(window->GetRootWindow()), | 37 root_window_(window->GetRootWindow()), |
| 38 root_window_controller_(root_window_->GetRootWindowController()), | 38 root_window_controller_(root_window_->GetRootWindowController()), |
| 39 shell_(window_->GetShell()), | 39 shell_(window_->GetShell()), |
| 40 work_area_in_parent_(wm::GetDisplayWorkAreaBoundsInParent(window_)), | 40 work_area_in_parent_(wm::GetDisplayWorkAreaBoundsInParent(window_)), |
| 41 is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr) { | 41 is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr) { |
| 42 shell_->AddShellObserver(this); | 42 shell_->AddShellObserver(this); |
| 43 shell_->AddActivationObserver(this); | 43 shell_->AddActivationObserver(this); |
| 44 root_window_->aura_window()->AddObserver(this); | 44 root_window_->aura_window()->AddObserver(this); |
| 45 display::Screen::GetScreen()->AddObserver(this); | 45 display::Screen::GetScreen()->AddObserver(this); |
| 46 DCHECK(window->GetBoolProperty( | 46 DCHECK(window->aura_window()->GetProperty(kSnapChildrenToPixelBoundary)); |
| 47 WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY)); | |
| 48 } | 47 } |
| 49 | 48 |
| 50 WorkspaceLayoutManager::~WorkspaceLayoutManager() { | 49 WorkspaceLayoutManager::~WorkspaceLayoutManager() { |
| 51 if (root_window_) | 50 if (root_window_) |
| 52 root_window_->aura_window()->RemoveObserver(this); | 51 root_window_->aura_window()->RemoveObserver(this); |
| 53 for (WmWindow* window : windows_) { | 52 for (WmWindow* window : windows_) { |
| 54 wm::WindowState* window_state = window->GetWindowState(); | 53 wm::WindowState* window_state = window->GetWindowState(); |
| 55 window_state->RemoveObserver(this); | 54 window_state->RemoveObserver(this); |
| 56 window->aura_window()->RemoveObserver(this); | 55 window->aura_window()->RemoveObserver(this); |
| 57 } | 56 } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 for (auto* window : windows) { | 378 for (auto* window : windows) { |
| 380 wm::WindowState* window_state = window->GetWindowState(); | 379 wm::WindowState* window_state = window->GetWindowState(); |
| 381 if (window_on_top) | 380 if (window_on_top) |
| 382 window_state->DisableAlwaysOnTop(window_on_top); | 381 window_state->DisableAlwaysOnTop(window_on_top); |
| 383 else | 382 else |
| 384 window_state->RestoreAlwaysOnTop(); | 383 window_state->RestoreAlwaysOnTop(); |
| 385 } | 384 } |
| 386 } | 385 } |
| 387 | 386 |
| 388 } // namespace ash | 387 } // namespace ash |
| OLD | NEW |