Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: components/session_manager/core/session_manager.cc

Issue 2878233003: Add CHECK on session start for profile construction (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/session_manager/core/session_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::HasSessionForAccountId(
66 const AccountId& user_account_id) const {
67 return std::find_if(sessions_.begin(), sessions_.end(),
68 [user_account_id](const Session& session) {
69 return session.user_account_id == user_account_id;
70 }) != sessions_.end();
71 }
72
65 bool SessionManager::IsInSecondaryLoginScreen() const { 73 bool SessionManager::IsInSecondaryLoginScreen() const {
66 return session_state_ == SessionState::LOGIN_SECONDARY; 74 return session_state_ == SessionState::LOGIN_SECONDARY;
67 } 75 }
68 76
69 bool SessionManager::IsScreenLocked() const { 77 bool SessionManager::IsScreenLocked() const {
70 return session_state_ == SessionState::LOCKED; 78 return session_state_ == SessionState::LOCKED;
71 } 79 }
72 80
73 bool SessionManager::IsUserSessionBlocked() const { 81 bool SessionManager::IsUserSessionBlocked() const {
74 return session_state_ != SessionState::ACTIVE; 82 return session_state_ != SessionState::ACTIVE;
(...skipping 17 matching lines...) Expand all
92 } 100 }
93 101
94 // static 102 // static
95 void SessionManager::SetInstance(SessionManager* session_manager) { 103 void SessionManager::SetInstance(SessionManager* session_manager) {
96 SessionManager::instance = session_manager; 104 SessionManager::instance = session_manager;
97 } 105 }
98 106
99 void SessionManager::CreateSessionInternal(const AccountId& user_account_id, 107 void SessionManager::CreateSessionInternal(const AccountId& user_account_id,
100 const std::string& user_id_hash, 108 const std::string& user_id_hash,
101 bool browser_restart) { 109 bool browser_restart) {
102 DCHECK(std::find_if(sessions_.begin(), sessions_.end(), 110 DCHECK(!HasSessionForAccountId(user_account_id));
103 [user_account_id](const Session& session) {
104 return session.user_account_id == user_account_id;
105 }) == sessions_.end());
106
107 sessions_.push_back({next_id_++, user_account_id}); 111 sessions_.push_back({next_id_++, user_account_id});
108 NotifyUserLoggedIn(user_account_id, user_id_hash, browser_restart); 112 NotifyUserLoggedIn(user_account_id, user_id_hash, browser_restart);
109 } 113 }
110 114
111 } // namespace session_manager 115 } // namespace session_manager
OLDNEW
« no previous file with comments | « components/session_manager/core/session_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698