| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | 5 #ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ |
| 6 #define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | 6 #define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 12 #include "components/session_manager/session_manager_export.h" | 14 #include "components/session_manager/session_manager_export.h" |
| 13 #include "components/session_manager/session_manager_types.h" | 15 #include "components/session_manager/session_manager_types.h" |
| 14 | 16 |
| 15 class AccountId; | 17 class AccountId; |
| 16 | 18 |
| 17 namespace session_manager { | 19 namespace session_manager { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 // Creates a session for the given user. The first one is for regular cases | 34 // Creates a session for the given user. The first one is for regular cases |
| 33 // and the 2nd one is for the crash-and-restart case. | 35 // and the 2nd one is for the crash-and-restart case. |
| 34 void CreateSession(const AccountId& user_account_id, | 36 void CreateSession(const AccountId& user_account_id, |
| 35 const std::string& user_id_hash); | 37 const std::string& user_id_hash); |
| 36 void CreateSessionForRestart(const AccountId& user_account_id, | 38 void CreateSessionForRestart(const AccountId& user_account_id, |
| 37 const std::string& user_id_hash); | 39 const std::string& user_id_hash); |
| 38 | 40 |
| 39 // Returns true if we're logged in and browser has been started i.e. | 41 // Returns true if we're logged in and browser has been started i.e. |
| 40 // browser_creator.LaunchBrowser(...) was called after sign in | 42 // browser_creator.LaunchBrowser(...) was called after sign in |
| 41 // or restart after crash. | 43 // or restart after crash. |
| 42 virtual bool IsSessionStarted() const; | 44 bool IsSessionStarted() const; |
| 43 | 45 |
| 44 // Called when browser session is started i.e. after | 46 // Called when browser session is started i.e. after |
| 45 // browser_creator.LaunchBrowser(...) was called after user sign in. | 47 // browser_creator.LaunchBrowser(...) was called after user sign in. |
| 46 // When user is at the image screen IsUserLoggedIn() will return true | 48 // When user is at the image screen IsUserLoggedIn() will return true |
| 47 // but IsSessionStarted() will return false. During the kiosk splash screen, | 49 // but IsSessionStarted() will return false. During the kiosk splash screen, |
| 48 // we perform additional initialization after the user is logged in but | 50 // we perform additional initialization after the user is logged in but |
| 49 // before the session has been started. | 51 // before the session has been started. |
| 50 virtual void SessionStarted(); | 52 virtual void SessionStarted(); |
| 51 | 53 |
| 54 // Convenience wrapps of session state. |
| 55 bool IsInSecondaryLoginScreen() const; |
| 56 bool IsScreenLocked() const; |
| 57 |
| 58 // Returns the maximum number of allowed user sessions. |
| 59 uint32_t GetMaximumNumberOfUserSessions() const; |
| 60 |
| 52 void AddObserver(SessionManagerObserver* observer); | 61 void AddObserver(SessionManagerObserver* observer); |
| 53 void RemoveObserver(SessionManagerObserver* observer); | 62 void RemoveObserver(SessionManagerObserver* observer); |
| 54 | 63 |
| 55 SessionState session_state() const { return session_state_; } | 64 SessionState session_state() const { return session_state_; } |
| 56 const std::vector<Session>& sessions() const { return sessions_; } | 65 const std::vector<Session>& sessions() const { return sessions_; } |
| 57 | 66 |
| 58 protected: | 67 protected: |
| 59 // Notifies UserManager about a user signs in when creating a user session. | 68 // Notifies UserManager about a user signs in when creating a user session. |
| 60 virtual void NotifyUserLoggedIn(const AccountId& user_account_id, | 69 virtual void NotifyUserLoggedIn(const AccountId& user_account_id, |
| 61 const std::string& user_id_hash, | 70 const std::string& user_id_hash, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 91 std::vector<Session> sessions_; | 100 std::vector<Session> sessions_; |
| 92 | 101 |
| 93 base::ObserverList<SessionManagerObserver> observers_; | 102 base::ObserverList<SessionManagerObserver> observers_; |
| 94 | 103 |
| 95 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 104 DISALLOW_COPY_AND_ASSIGN(SessionManager); |
| 96 }; | 105 }; |
| 97 | 106 |
| 98 } // namespace session_manager | 107 } // namespace session_manager |
| 99 | 108 |
| 100 #endif // COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | 109 #endif // COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ |
| OLD | NEW |