| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/screen_pinning_controller.h" | 5 #include "ash/wm/screen_pinning_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_port.h" |
| 12 #include "ash/window_user_data.h" | 13 #include "ash/window_user_data.h" |
| 13 #include "ash/wm/container_finder.h" | 14 #include "ash/wm/container_finder.h" |
| 14 #include "ash/wm/window_dimmer.h" | 15 #include "ash/wm/window_dimmer.h" |
| 15 #include "ash/wm/window_state.h" | 16 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm_shell.h" | |
| 17 #include "ash/wm_window.h" | 17 #include "ash/wm_window.h" |
| 18 #include "base/auto_reset.h" | 18 #include "base/auto_reset.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_observer.h" | 22 #include "ui/aura/window_observer.h" |
| 23 #include "ui/wm/core/window_util.h" | 23 #include "ui/wm/core/window_util.h" |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 namespace { | 26 namespace { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 ScreenPinningController::ScreenPinningController() | 150 ScreenPinningController::ScreenPinningController() |
| 151 : window_dimmers_(base::MakeUnique<WindowUserData<WindowDimmer>>()), | 151 : window_dimmers_(base::MakeUnique<WindowUserData<WindowDimmer>>()), |
| 152 pinned_container_window_observer_( | 152 pinned_container_window_observer_( |
| 153 base::MakeUnique<PinnedContainerWindowObserver>(this)), | 153 base::MakeUnique<PinnedContainerWindowObserver>(this)), |
| 154 pinned_container_child_window_observer_( | 154 pinned_container_child_window_observer_( |
| 155 base::MakeUnique<PinnedContainerChildWindowObserver>(this)), | 155 base::MakeUnique<PinnedContainerChildWindowObserver>(this)), |
| 156 system_modal_container_window_observer_( | 156 system_modal_container_window_observer_( |
| 157 base::MakeUnique<SystemModalContainerWindowObserver>(this)), | 157 base::MakeUnique<SystemModalContainerWindowObserver>(this)), |
| 158 system_modal_container_child_window_observer_( | 158 system_modal_container_child_window_observer_( |
| 159 base::MakeUnique<SystemModalContainerChildWindowObserver>(this)) { | 159 base::MakeUnique<SystemModalContainerChildWindowObserver>(this)) { |
| 160 WmShell::Get()->AddDisplayObserver(this); | 160 ShellPort::Get()->AddDisplayObserver(this); |
| 161 } | 161 } |
| 162 | 162 |
| 163 ScreenPinningController::~ScreenPinningController() { | 163 ScreenPinningController::~ScreenPinningController() { |
| 164 WmShell::Get()->RemoveDisplayObserver(this); | 164 ShellPort::Get()->RemoveDisplayObserver(this); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool ScreenPinningController::IsPinned() const { | 167 bool ScreenPinningController::IsPinned() const { |
| 168 return pinned_window_ != nullptr; | 168 return pinned_window_ != nullptr; |
| 169 } | 169 } |
| 170 | 170 |
| 171 void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) { | 171 void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) { |
| 172 if (pinned_window->GetWindowState()->IsPinned()) { | 172 if (pinned_window->GetWindowState()->IsPinned()) { |
| 173 if (pinned_window_) { | 173 if (pinned_window_) { |
| 174 LOG(DFATAL) << "Pinned mode is enabled, while it is already in " | 174 LOG(DFATAL) << "Pinned mode is enabled, while it is already in " |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 return; | 344 return; |
| 345 | 345 |
| 346 WindowDimmer* window_dimmer = window_dimmers_->Get(container); | 346 WindowDimmer* window_dimmer = window_dimmers_->Get(container); |
| 347 if (window_dimmer) { | 347 if (window_dimmer) { |
| 348 base::AutoReset<bool> auto_reset(&in_restacking_, true); | 348 base::AutoReset<bool> auto_reset(&in_restacking_, true); |
| 349 container->StackChildAtBottom(window_dimmer->window()); | 349 container->StackChildAtBottom(window_dimmer->window()); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 } // namespace ash | 353 } // namespace ash |
| OLD | NEW |