| 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/cast_config_controller.h" | 10 #include "ash/common/cast_config_controller.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 shelf_controller_.reset(); | 76 shelf_controller_.reset(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 ShelfModel* WmShell::shelf_model() { | 79 ShelfModel* WmShell::shelf_model() { |
| 80 return shelf_controller_->model(); | 80 return shelf_controller_->model(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void WmShell::ShowContextMenu(const gfx::Point& location_in_screen, | 83 void WmShell::ShowContextMenu(const gfx::Point& location_in_screen, |
| 84 ui::MenuSourceType source_type) { | 84 ui::MenuSourceType source_type) { |
| 85 // Bail if there is no active user session or if the screen is locked. | 85 // Bail if there is no active user session or if the screen is locked. |
| 86 if (GetSessionStateDelegate()->NumberOfLoggedInUsers() < 1 || | 86 if (session_controller()->NumberOfLoggedInUsers() < 1 || |
| 87 GetSessionStateDelegate()->IsScreenLocked()) { | 87 session_controller()->IsScreenLocked()) { |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 | 90 |
| 91 WmWindow* root = wm::GetRootWindowAt(location_in_screen); | 91 WmWindow* root = wm::GetRootWindowAt(location_in_screen); |
| 92 root->GetRootWindowController()->ShowContextMenu(location_in_screen, | 92 root->GetRootWindowController()->ShowContextMenu(location_in_screen, |
| 93 source_type); | 93 source_type); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void WmShell::CreateShelfView() { | 96 void WmShell::CreateShelfView() { |
| 97 // Must occur after SessionStateDelegate creation and user login. | 97 // Must occur after SessionController creation and user login. |
| 98 DCHECK(GetSessionStateDelegate()); | 98 DCHECK(session_controller()); |
| 99 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); | 99 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0); |
| 100 CreateShelfDelegate(); | 100 CreateShelfDelegate(); |
| 101 | 101 |
| 102 for (WmWindow* root_window : GetAllRootWindows()) | 102 for (WmWindow* root_window : GetAllRootWindows()) |
| 103 root_window->GetRootWindowController()->CreateShelfView(); | 103 root_window->GetRootWindowController()->CreateShelfView(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void WmShell::CreateShelfDelegate() { | 106 void WmShell::CreateShelfDelegate() { |
| 107 // May be called multiple times as shelves are created and destroyed. | 107 // May be called multiple times as shelves are created and destroyed. |
| 108 if (shelf_delegate_) | 108 if (shelf_delegate_) |
| 109 return; | 109 return; |
| 110 // Must occur after SessionStateDelegate creation and user login because | 110 // Must occur after SessionController creation and user login because |
| 111 // Chrome's implementation of ShelfDelegate assumes it can get information | 111 // Chrome's implementation of ShelfDelegate assumes it can get information |
| 112 // about multi-profile login state. | 112 // about multi-profile login state. |
| 113 DCHECK(GetSessionStateDelegate()); | 113 DCHECK(session_controller()); |
| 114 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); | 114 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0); |
| 115 shelf_delegate_.reset( | 115 shelf_delegate_.reset( |
| 116 Shell::Get()->shell_delegate()->CreateShelfDelegate(shelf_model())); | 116 Shell::Get()->shell_delegate()->CreateShelfDelegate(shelf_model())); |
| 117 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model())); | 117 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model())); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) { | 120 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) { |
| 121 for (WmWindow* root_window : GetAllRootWindows()) { | 121 for (WmWindow* root_window : GetAllRootWindows()) { |
| 122 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( | 122 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( |
| 123 status); | 123 status); |
| 124 } | 124 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 // Only trigger an update in mash because with classic ash chrome calls | 275 // Only trigger an update in mash because with classic ash chrome calls |
| 276 // UpdateAfterLoginStatusChange() directly. | 276 // UpdateAfterLoginStatusChange() directly. |
| 277 if (IsRunningInMash()) { | 277 if (IsRunningInMash()) { |
| 278 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? | 278 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? |
| 279 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); | 279 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); |
| 280 } | 280 } |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace ash | 283 } // namespace ash |
| OLD | NEW |