Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: ash/session/session_controller.cc

Issue 2822033002: cros: Use SessionController to enable system tray settings / notifications tray (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/session/session_controller.h" 5 #include "ash/session/session_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/session/session_state_observer.h" 9 #include "ash/session/session_state_observer.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 bool SessionController::IsInSecondaryLoginScreen() const { 91 bool SessionController::IsInSecondaryLoginScreen() const {
92 return state_ == SessionState::LOGIN_SECONDARY; 92 return state_ == SessionState::LOGIN_SECONDARY;
93 } 93 }
94 94
95 SessionState SessionController::GetSessionState() const { 95 SessionState SessionController::GetSessionState() const {
96 return state_; 96 return state_;
97 } 97 }
98 98
99 bool SessionController::ShouldEnableSettings() const {
100 // Settings opens a web UI window, so it is not available at the lock screen.
101 if (!IsActiveUserSessionStarted() || IsScreenLocked() ||
102 IsInSecondaryLoginScreen()) {
103 return false;
104 }
105
106 return user_sessions_[0]->should_enable_settings;
107 }
108
109 bool SessionController::ShouldShowNotificationTray() const {
110 if (!IsActiveUserSessionStarted() || IsInSecondaryLoginScreen())
111 return false;
112
113 return user_sessions_[0]->should_show_notification_tray;
114 }
115
99 const std::vector<mojom::UserSessionPtr>& SessionController::GetUserSessions() 116 const std::vector<mojom::UserSessionPtr>& SessionController::GetUserSessions()
100 const { 117 const {
101 return user_sessions_; 118 return user_sessions_;
102 } 119 }
103 120
104 const mojom::UserSession* SessionController::GetUserSession( 121 const mojom::UserSession* SessionController::GetUserSession(
105 UserIndex index) const { 122 UserIndex index) const {
106 if (index < 0 || index >= static_cast<UserIndex>(user_sessions_.size())) 123 if (index < 0 || index >= static_cast<UserIndex>(user_sessions_.size()))
107 return nullptr; 124 return nullptr;
108 125
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 const LoginStatus new_login_status = CalculateLoginStatus(); 326 const LoginStatus new_login_status = CalculateLoginStatus();
310 if (new_login_status == login_status_) 327 if (new_login_status == login_status_)
311 return; 328 return;
312 329
313 login_status_ = new_login_status; 330 login_status_ = new_login_status;
314 for (auto& observer : observers_) 331 for (auto& observer : observers_)
315 observer.LoginStatusChanged(login_status_); 332 observer.LoginStatusChanged(login_status_);
316 } 333 }
317 334
318 } // namespace ash 335 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698