| 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 #include "components/session_manager/core/session_manager.h" | 5 #include "components/session_manager/core/session_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool SessionManager::IsInSecondaryLoginScreen() const { | 65 bool SessionManager::IsInSecondaryLoginScreen() const { |
| 66 return session_state_ == SessionState::LOGIN_SECONDARY; | 66 return session_state_ == SessionState::LOGIN_SECONDARY; |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool SessionManager::IsScreenLocked() const { | 69 bool SessionManager::IsScreenLocked() const { |
| 70 return session_state_ == SessionState::LOCKED; | 70 return session_state_ == SessionState::LOCKED; |
| 71 } | 71 } |
| 72 | 72 |
| 73 uint32_t SessionManager::GetMaximumNumberOfUserSessions() const { | |
| 74 // Limits the number of logged in users to 10 due to memory constraints. | |
| 75 return 10u; | |
| 76 } | |
| 77 | |
| 78 void SessionManager::AddObserver(SessionManagerObserver* observer) { | 73 void SessionManager::AddObserver(SessionManagerObserver* observer) { |
| 79 observers_.AddObserver(observer); | 74 observers_.AddObserver(observer); |
| 80 } | 75 } |
| 81 | 76 |
| 82 void SessionManager::RemoveObserver(SessionManagerObserver* observer) { | 77 void SessionManager::RemoveObserver(SessionManagerObserver* observer) { |
| 83 observers_.RemoveObserver(observer); | 78 observers_.RemoveObserver(observer); |
| 84 } | 79 } |
| 85 | 80 |
| 86 void SessionManager::NotifyUserLoggedIn(const AccountId& user_account_id, | 81 void SessionManager::NotifyUserLoggedIn(const AccountId& user_account_id, |
| 87 const std::string& user_id_hash, | 82 const std::string& user_id_hash, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 103 DCHECK(std::find_if(sessions_.begin(), sessions_.end(), | 98 DCHECK(std::find_if(sessions_.begin(), sessions_.end(), |
| 104 [user_account_id](const Session& session) { | 99 [user_account_id](const Session& session) { |
| 105 return session.user_account_id == user_account_id; | 100 return session.user_account_id == user_account_id; |
| 106 }) == sessions_.end()); | 101 }) == sessions_.end()); |
| 107 | 102 |
| 108 sessions_.push_back({next_id_++, user_account_id}); | 103 sessions_.push_back({next_id_++, user_account_id}); |
| 109 NotifyUserLoggedIn(user_account_id, user_id_hash, browser_restart); | 104 NotifyUserLoggedIn(user_account_id, user_id_hash, browser_restart); |
| 110 } | 105 } |
| 111 | 106 |
| 112 } // namespace session_manager | 107 } // namespace session_manager |
| OLD | NEW |