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 "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" | 5 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 VLOG(1) << "OnRefreshTokenAvailable"; | 131 VLOG(1) << "OnRefreshTokenAvailable"; |
132 | 132 |
133 if (state_ == SESSION_RESTORE_NOT_STARTED) | 133 if (state_ == SESSION_RESTORE_NOT_STARTED) |
134 return; | 134 return; |
135 | 135 |
136 // TODO(fgorski): Once ProfileOAuth2TokenService supports multi-login, make | 136 // TODO(fgorski): Once ProfileOAuth2TokenService supports multi-login, make |
137 // sure to restore session cookies in the context of the correct account_id. | 137 // sure to restore session cookies in the context of the correct account_id. |
138 | 138 |
139 // Do not validate tokens for supervised users, as they don't actually have | 139 // Do not validate tokens for supervised users, as they don't actually have |
140 // oauth2 token. | 140 // oauth2 token. |
141 if (UserManager::Get()->IsLoggedInAsLocallyManagedUser()) { | 141 if (UserManager::Get()->IsLoggedInAsSupervisedUser()) { |
142 VLOG(1) << "Logged in as managed user, skip token validation."; | 142 VLOG(1) << "Logged in as supervised user, skip token validation."; |
143 return; | 143 return; |
144 } | 144 } |
145 // Only restore session cookies for the primary account in the profile. | 145 // Only restore session cookies for the primary account in the profile. |
146 if (GetPrimaryAccountId() == account_id) { | 146 if (GetPrimaryAccountId() == account_id) { |
147 // Token is loaded. Undo the flagging before token loading. | 147 // Token is loaded. Undo the flagging before token loading. |
148 UserManager::Get()->SaveUserOAuthStatus(account_id, | 148 UserManager::Get()->SaveUserOAuthStatus(account_id, |
149 User::OAUTH2_TOKEN_STATUS_VALID); | 149 User::OAUTH2_TOKEN_STATUS_VALID); |
150 VerifySessionCookies(); | 150 VerifySessionCookies(); |
151 } | 151 } |
152 } | 152 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 FOR_EACH_OBSERVER(Observer, observer_list_, | 395 FOR_EACH_OBSERVER(Observer, observer_list_, |
396 OnSessionRestoreStateChanged(user_profile_, state_)); | 396 OnSessionRestoreStateChanged(user_profile_, state_)); |
397 } | 397 } |
398 | 398 |
399 void OAuth2LoginManager::SetSessionRestoreStartForTesting( | 399 void OAuth2LoginManager::SetSessionRestoreStartForTesting( |
400 const base::Time& time) { | 400 const base::Time& time) { |
401 session_restore_start_ = time; | 401 session_restore_start_ = time; |
402 } | 402 } |
403 | 403 |
404 } // namespace chromeos | 404 } // namespace chromeos |
OLD | NEW |