Chromium Code Reviews| Index: components/session_manager/core/session_manager.h |
| diff --git a/components/session_manager/core/session_manager.h b/components/session_manager/core/session_manager.h |
| index 53623178136041a46941716bd4f08a3a9b935a70..7c66cebf83f8ec88bfb2667f09c49d76d19b7f71 100644 |
| --- a/components/session_manager/core/session_manager.h |
| +++ b/components/session_manager/core/session_manager.h |
| @@ -5,10 +5,14 @@ |
| #ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ |
| #define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ |
| +#include <vector> |
| + |
| #include "base/macros.h" |
| #include "components/session_manager/session_manager_export.h" |
| #include "components/session_manager/session_manager_types.h" |
| +class AccountId; |
| + |
| namespace session_manager { |
| class SESSION_EXPORT SessionManager { |
| @@ -20,8 +24,15 @@ class SESSION_EXPORT SessionManager { |
| // initialized yet. |
| static SessionManager* Get(); |
| - SessionState session_state() const { return session_state_; } |
| - virtual void SetSessionState(SessionState state); |
| + void SetSessionState(SessionState state); |
| + |
| + // Creates a session for the given user. The first one is for regular case |
| + // and the 2nd one is for crash-and-restart case. |
| + void CreateSession(const AccountId& user_account_id, |
|
achuithb
2016/10/31 22:41:36
I feel like I'm being nitpicky, and am fine with t
xiyuan
2016/11/01 16:24:31
All sites except one are passing a false for the f
|
| + const std::string& user_id_hash); |
| + void CreateSession(const AccountId& user_account_id, |
| + const std::string& user_id_hash, |
| + bool browser_restart); |
| // Returns true if we're logged in and browser has been started i.e. |
| // browser_creator.LaunchBrowser(...) was called after sign in |
| @@ -36,7 +47,15 @@ class SESSION_EXPORT SessionManager { |
| // before the session has been started. |
| virtual void SessionStarted(); |
| + SessionState session_state() const { return session_state_; } |
| + const std::vector<Session>& sessions() const { return sessions_; } |
| + |
| protected: |
| + // Notifies UserManager about a user signs in when creating a user session. |
| + virtual void NotifyUserLoggedIn(const AccountId& user_account_id, |
| + const std::string& user_id_hash, |
| + bool browser_restart); |
| + |
| // Sets SessionManager instance. |
| static void SetInstance(SessionManager* session_manager); |
| @@ -53,6 +72,15 @@ class SESSION_EXPORT SessionManager { |
| // True if SessionStarted() has been called. |
| bool session_started_ = false; |
| + // Id of the primary session, i.e. the first user session. |
| + static const SessionId kPrimarySessionId = 1; |
| + |
| + // ID assigned to the next session. |
| + SessionId next_id_ = kPrimarySessionId; |
| + |
| + // Keeps track of user sessions. |
| + std::vector<Session> sessions_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(SessionManager); |
| }; |