| 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/common/window_user_data.h" | 10 #include "ash/common/window_user_data.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 ScreenPinningController::~ScreenPinningController() { | 165 ScreenPinningController::~ScreenPinningController() { |
| 166 window_tree_host_manager_->RemoveObserver(this); | 166 window_tree_host_manager_->RemoveObserver(this); |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool ScreenPinningController::IsPinned() const { | 169 bool ScreenPinningController::IsPinned() const { |
| 170 return pinned_window_ != nullptr; | 170 return pinned_window_ != nullptr; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) { | 173 void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) { |
| 174 window_dimmers_->clear(); | |
| 175 | |
| 176 if (pinned_window->GetWindowState()->IsPinned()) { | 174 if (pinned_window->GetWindowState()->IsPinned()) { |
| 177 if (pinned_window_) { | 175 if (pinned_window_) { |
| 178 LOG(DFATAL) << "Pinned mode is enabled, while it is already in " | 176 LOG(DFATAL) << "Pinned mode is enabled, while it is already in " |
| 179 << "the pinned mode"; | 177 << "the pinned mode"; |
| 180 return; | 178 return; |
| 181 } | 179 } |
| 182 | 180 |
| 183 WmWindow* container = pinned_window->GetParent(); | 181 WmWindow* container = pinned_window->GetParent(); |
| 184 std::vector<WmWindow*> system_modal_containers = | 182 std::vector<WmWindow*> system_modal_containers = |
| 185 GetSystemModalWindowsExceptPinned(pinned_window); | 183 GetSystemModalWindowsExceptPinned(pinned_window); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 GetSystemModalWindowsExceptPinned(pinned_window_)) { | 219 GetSystemModalWindowsExceptPinned(pinned_window_)) { |
| 222 RemoveObserverFromChildren( | 220 RemoveObserverFromChildren( |
| 223 system_modal, system_modal_container_child_window_observer_.get()); | 221 system_modal, system_modal_container_child_window_observer_.get()); |
| 224 WmWindow::GetAuraWindow(system_modal) | 222 WmWindow::GetAuraWindow(system_modal) |
| 225 ->RemoveObserver(system_modal_container_window_observer_.get()); | 223 ->RemoveObserver(system_modal_container_window_observer_.get()); |
| 226 } | 224 } |
| 227 RemoveObserverFromChildren(container, | 225 RemoveObserverFromChildren(container, |
| 228 pinned_container_child_window_observer_.get()); | 226 pinned_container_child_window_observer_.get()); |
| 229 WmWindow::GetAuraWindow(container)->RemoveObserver( | 227 WmWindow::GetAuraWindow(container)->RemoveObserver( |
| 230 pinned_container_window_observer_.get()); | 228 pinned_container_window_observer_.get()); |
| 229 window_dimmers_->clear(); |
| 231 | 230 |
| 232 pinned_window_ = nullptr; | 231 pinned_window_ = nullptr; |
| 233 } | 232 } |
| 234 | 233 |
| 235 Shell::GetInstance()->NotifyPinnedStateChanged(pinned_window); | 234 Shell::GetInstance()->NotifyPinnedStateChanged(pinned_window); |
| 236 } | 235 } |
| 237 | 236 |
| 238 void ScreenPinningController::OnWindowAddedToPinnedContainer( | 237 void ScreenPinningController::OnWindowAddedToPinnedContainer( |
| 239 WmWindow* new_window) { | 238 WmWindow* new_window) { |
| 240 KeepPinnedWindowOnTop(); | 239 KeepPinnedWindowOnTop(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 return; | 345 return; |
| 347 | 346 |
| 348 WindowDimmer* window_dimmer = window_dimmers_->Get(container); | 347 WindowDimmer* window_dimmer = window_dimmers_->Get(container); |
| 349 if (window_dimmer) { | 348 if (window_dimmer) { |
| 350 base::AutoReset<bool> auto_reset(&in_restacking_, true); | 349 base::AutoReset<bool> auto_reset(&in_restacking_, true); |
| 351 container->StackChildAtBottom(window_dimmer->window()); | 350 container->StackChildAtBottom(window_dimmer->window()); |
| 352 } | 351 } |
| 353 } | 352 } |
| 354 | 353 |
| 355 } // namespace ash | 354 } // namespace ash |
| OLD | NEW |