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..2580d8d18ff78f0dfdff433921cd1cf4d9885ac4 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,9 +24,13 @@ class SESSION_EXPORT SessionManager { |
| // initialized yet. |
| static SessionManager* Get(); |
| - SessionState session_state() const { return session_state_; } |
| virtual void SetSessionState(SessionState state); |
| + // Creates a session for the given user. |
| + virtual void CreateSession(const AccountId& user_account_id, |
| + const std::string& user_id_hash, |
| + bool browser_restart = false); |
|
achuithb
2016/10/31 21:55:57
I think we're not supposed to use default argument
xiyuan
2016/10/31 22:29:45
Changed to use function overloading and removed "v
|
| + |
| // Returns true if we're logged in and browser has been started i.e. |
| // browser_creator.LaunchBrowser(...) was called after sign in |
| // or restart after crash. |
| @@ -36,7 +44,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 +69,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); |
| }; |