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