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

Unified Diff: ash/common/session/session_controller.h

Issue 2797743002: ash: Merge LoginStatus update code path (Closed)
Patch Set: for #2 comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/common/session/session_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/session/session_controller.h
diff --git a/ash/common/session/session_controller.h b/ash/common/session/session_controller.h
index c7227c2ad601fc2bf27ba9a45788c902991a04d5..23260387737c59e3f5e0d6a23c3305e11bc5b946 100644
--- a/ash/common/session/session_controller.h
+++ b/ash/common/session/session_controller.h
@@ -10,6 +10,7 @@
#include <vector>
#include "ash/ash_export.h"
+#include "ash/common/login_status.h"
#include "ash/public/cpp/session_types.h"
#include "ash/public/interfaces/session_controller.mojom.h"
#include "base/macros.h"
@@ -20,7 +21,6 @@ class AccountId;
namespace ash {
-enum class LoginStatus;
class SessionStateObserver;
// Implements mojom::SessionController to cache session related info such as
@@ -96,7 +96,7 @@ class ASH_EXPORT SessionController
// Returns the ash notion of login status.
// NOTE: Prefer GetSessionState() in new code because the concept of
// SessionState more closes matches the state in chrome.
- LoginStatus GetLoginStatus() const;
+ LoginStatus login_status() const { return login_status_; }
// mojom::SessionController
void SetClient(mojom::SessionControllerClientPtr client) override;
@@ -114,8 +114,14 @@ class ASH_EXPORT SessionController
void SetSessionState(session_manager::SessionState state);
void AddUserSession(mojom::UserSessionPtr user_session);
+ // Calculate login status based on session state and active user session.
+ LoginStatus CalculateLoginStatus() const;
+
// Helper that returns login status when the session state is ACTIVE.
- LoginStatus GetLoginStatusForActiveSession() const;
+ LoginStatus CalculateLoginStatusForActiveSession() const;
+
+ // Update the |login_status_| and notify observers.
+ void UpdateLoginStatus();
// Bindings for mojom::SessionController interface.
mojo::BindingSet<mojom::SessionController> bindings_;
@@ -139,6 +145,9 @@ class ASH_EXPORT SessionController
// to detect first active user session.
uint32_t active_session_id_ = 0u;
+ // Last known login status. Used to track login status changes.
+ LoginStatus login_status_ = LoginStatus::NOT_LOGGED_IN;
+
base::ObserverList<ash::SessionStateObserver> observers_;
DISALLOW_COPY_AND_ASSIGN(SessionController);
« no previous file with comments | « no previous file | ash/common/session/session_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698