Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool SessionManager::IsSessionStarted() const { | 57 bool SessionManager::IsSessionStarted() const { |
| 58 return session_started_; | 58 return session_started_; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void SessionManager::SessionStarted() { | 61 void SessionManager::SessionStarted() { |
| 62 session_started_ = true; | 62 session_started_ = true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool SessionManager::IsInSecondaryLoginScreen() const { | |
| 66 return session_state_ == session_manager::SessionState::LOGIN_SECONDARY; | |
|
James Cook
2017/01/06 23:52:43
nit: I don't think session_manager:: is needed her
xiyuan
2017/01/07 00:07:32
Right. Remove here the Line 70.
| |
| 67 } | |
| 68 | |
| 69 bool SessionManager::IsScreenLocked() const { | |
| 70 return session_state_ == session_manager::SessionState::LOCKED; | |
| 71 } | |
| 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 | |
| 65 void SessionManager::AddObserver(SessionManagerObserver* observer) { | 78 void SessionManager::AddObserver(SessionManagerObserver* observer) { |
| 66 observers_.AddObserver(observer); | 79 observers_.AddObserver(observer); |
| 67 } | 80 } |
| 68 | 81 |
| 69 void SessionManager::RemoveObserver(SessionManagerObserver* observer) { | 82 void SessionManager::RemoveObserver(SessionManagerObserver* observer) { |
| 70 observers_.RemoveObserver(observer); | 83 observers_.RemoveObserver(observer); |
| 71 } | 84 } |
| 72 | 85 |
| 73 void SessionManager::NotifyUserLoggedIn(const AccountId& user_account_id, | 86 void SessionManager::NotifyUserLoggedIn(const AccountId& user_account_id, |
| 74 const std::string& user_id_hash, | 87 const std::string& user_id_hash, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 90 DCHECK(std::find_if(sessions_.begin(), sessions_.end(), | 103 DCHECK(std::find_if(sessions_.begin(), sessions_.end(), |
| 91 [user_account_id](const Session& session) { | 104 [user_account_id](const Session& session) { |
| 92 return session.user_account_id == user_account_id; | 105 return session.user_account_id == user_account_id; |
| 93 }) == sessions_.end()); | 106 }) == sessions_.end()); |
| 94 | 107 |
| 95 sessions_.push_back({next_id_++, user_account_id}); | 108 sessions_.push_back({next_id_++, user_account_id}); |
| 96 NotifyUserLoggedIn(user_account_id, user_id_hash, browser_restart); | 109 NotifyUserLoggedIn(user_account_id, user_id_hash, browser_restart); |
| 97 } | 110 } |
| 98 | 111 |
| 99 } // namespace session_manager | 112 } // namespace session_manager |
| OLD | NEW |