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 SessionStateDelegate creation and user login. |
James Cook
2017/03/17 17:14:36
Is this comment still correct?
xiyuan
2017/03/17 22:52:02
Removed. SessionStateDelegate is no longer relevan
| |
98 DCHECK(GetSessionStateDelegate()); | 98 // Must occur after SessionController creation and user login. |
99 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); | 99 DCHECK(session_controller()); |
100 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0); | |
100 CreateShelfDelegate(); | 101 CreateShelfDelegate(); |
101 | 102 |
102 for (WmWindow* root_window : GetAllRootWindows()) | 103 for (WmWindow* root_window : GetAllRootWindows()) |
103 root_window->GetRootWindowController()->CreateShelfView(); | 104 root_window->GetRootWindowController()->CreateShelfView(); |
104 } | 105 } |
105 | 106 |
106 void WmShell::CreateShelfDelegate() { | 107 void WmShell::CreateShelfDelegate() { |
107 // May be called multiple times as shelves are created and destroyed. | 108 // May be called multiple times as shelves are created and destroyed. |
108 if (shelf_delegate_) | 109 if (shelf_delegate_) |
109 return; | 110 return; |
110 // Must occur after SessionStateDelegate creation and user login because | 111 // Must occur after SessionController creation and user login because |
111 // Chrome's implementation of ShelfDelegate assumes it can get information | 112 // Chrome's implementation of ShelfDelegate assumes it can get information |
112 // about multi-profile login state. | 113 // about multi-profile login state. |
113 DCHECK(GetSessionStateDelegate()); | 114 DCHECK(session_controller()); |
114 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); | 115 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0); |
115 shelf_delegate_.reset( | 116 shelf_delegate_.reset( |
116 Shell::Get()->shell_delegate()->CreateShelfDelegate(shelf_model())); | 117 Shell::Get()->shell_delegate()->CreateShelfDelegate(shelf_model())); |
117 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model())); | 118 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model())); |
118 } | 119 } |
119 | 120 |
120 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) { | 121 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) { |
121 for (WmWindow* root_window : GetAllRootWindows()) { | 122 for (WmWindow* root_window : GetAllRootWindows()) { |
122 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( | 123 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( |
123 status); | 124 status); |
124 } | 125 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 | 280 |
280 // Only trigger an update in mash because with classic ash chrome calls | 281 // Only trigger an update in mash because with classic ash chrome calls |
281 // UpdateAfterLoginStatusChange() directly. | 282 // UpdateAfterLoginStatusChange() directly. |
282 if (IsRunningInMash()) { | 283 if (IsRunningInMash()) { |
283 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? | 284 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? |
284 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); | 285 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); |
285 } | 286 } |
286 } | 287 } |
287 | 288 |
288 } // namespace ash | 289 } // namespace ash |
OLD | NEW |