| 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/common/wm_shell.h" | 5 #include "ash/common/wm_shell.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
| 10 #include "ash/common/accelerators/ash_focus_manager_factory.h" | 10 #include "ash/common/accelerators/ash_focus_manager_factory.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (GetSessionStateDelegate()->NumberOfLoggedInUsers() < 1 || | 146 if (GetSessionStateDelegate()->NumberOfLoggedInUsers() < 1 || |
| 147 GetSessionStateDelegate()->IsScreenLocked()) { | 147 GetSessionStateDelegate()->IsScreenLocked()) { |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 | 150 |
| 151 WmWindow* root = wm::GetRootWindowAt(location_in_screen); | 151 WmWindow* root = wm::GetRootWindowAt(location_in_screen); |
| 152 root->GetRootWindowController()->ShowContextMenu(location_in_screen, | 152 root->GetRootWindowController()->ShowContextMenu(location_in_screen, |
| 153 source_type); | 153 source_type); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void WmShell::CreateShelf() { | 156 void WmShell::CreateShelfView() { |
| 157 // Must occur after SessionStateDelegate creation and user login. | 157 // Must occur after SessionStateDelegate creation and user login. |
| 158 DCHECK(GetSessionStateDelegate()); | 158 DCHECK(GetSessionStateDelegate()); |
| 159 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); | 159 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); |
| 160 CreateShelfDelegate(); | 160 CreateShelfDelegate(); |
| 161 | 161 |
| 162 for (WmWindow* root_window : GetAllRootWindows()) | 162 for (WmWindow* root_window : GetAllRootWindows()) |
| 163 root_window->GetRootWindowController()->CreateShelf(); | 163 root_window->GetRootWindowController()->CreateShelfView(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void WmShell::CreateShelfDelegate() { | 166 void WmShell::CreateShelfDelegate() { |
| 167 // May be called multiple times as shelves are created and destroyed. | 167 // May be called multiple times as shelves are created and destroyed. |
| 168 if (shelf_delegate_) | 168 if (shelf_delegate_) |
| 169 return; | 169 return; |
| 170 // Must occur after SessionStateDelegate creation and user login because | 170 // Must occur after SessionStateDelegate creation and user login because |
| 171 // Chrome's implementation of ShelfDelegate assumes it can get information | 171 // Chrome's implementation of ShelfDelegate assumes it can get information |
| 172 // about multi-profile login state. | 172 // about multi-profile login state. |
| 173 DCHECK(GetSessionStateDelegate()); | 173 DCHECK(GetSessionStateDelegate()); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 431 |
| 432 void WmShell::SetAcceleratorController( | 432 void WmShell::SetAcceleratorController( |
| 433 std::unique_ptr<AcceleratorController> accelerator_controller) { | 433 std::unique_ptr<AcceleratorController> accelerator_controller) { |
| 434 accelerator_controller_ = std::move(accelerator_controller); | 434 accelerator_controller_ = std::move(accelerator_controller); |
| 435 } | 435 } |
| 436 | 436 |
| 437 void WmShell::SessionStateChanged(session_manager::SessionState state) { | 437 void WmShell::SessionStateChanged(session_manager::SessionState state) { |
| 438 // Create the shelf when a session becomes active. It's safe to do this | 438 // Create the shelf when a session becomes active. It's safe to do this |
| 439 // multiple times (e.g. initial login vs. multiprofile add session). | 439 // multiple times (e.g. initial login vs. multiprofile add session). |
| 440 if (state == session_manager::SessionState::ACTIVE) | 440 if (state == session_manager::SessionState::ACTIVE) |
| 441 CreateShelf(); | 441 CreateShelfView(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void WmShell::OnWindowActivated( | 444 void WmShell::OnWindowActivated( |
| 445 aura::client::ActivationChangeObserver::ActivationReason reason, | 445 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 446 aura::Window* gained_active, | 446 aura::Window* gained_active, |
| 447 aura::Window* lost_active) { | 447 aura::Window* lost_active) { |
| 448 WmWindow* gained_active_wm = WmWindow::Get(gained_active); | 448 WmWindow* gained_active_wm = WmWindow::Get(gained_active); |
| 449 WmWindow* lost_active_wm = WmWindow::Get(lost_active); | 449 WmWindow* lost_active_wm = WmWindow::Get(lost_active); |
| 450 if (gained_active_wm) | 450 if (gained_active_wm) |
| 451 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); | 451 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); |
| 452 for (auto& observer : activation_observers_) | 452 for (auto& observer : activation_observers_) |
| 453 observer.OnWindowActivated(gained_active_wm, lost_active_wm); | 453 observer.OnWindowActivated(gained_active_wm, lost_active_wm); |
| 454 } | 454 } |
| 455 | 455 |
| 456 void WmShell::OnAttemptToReactivateWindow(aura::Window* request_active, | 456 void WmShell::OnAttemptToReactivateWindow(aura::Window* request_active, |
| 457 aura::Window* actual_active) { | 457 aura::Window* actual_active) { |
| 458 for (auto& observer : activation_observers_) { | 458 for (auto& observer : activation_observers_) { |
| 459 observer.OnAttemptToReactivateWindow(WmWindow::Get(request_active), | 459 observer.OnAttemptToReactivateWindow(WmWindow::Get(request_active), |
| 460 WmWindow::Get(actual_active)); | 460 WmWindow::Get(actual_active)); |
| 461 } | 461 } |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace ash | 464 } // namespace ash |
| OLD | NEW |