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/screens/user_selection_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 user_dict->SetString(kKeyMultiProfilesPolicy, behavior); | 225 user_dict->SetString(kKeyMultiProfilesPolicy, behavior); |
226 } else { | 226 } else { |
227 user_dict->SetBoolean(kKeyMultiProfilesAllowed, true); | 227 user_dict->SetBoolean(kKeyMultiProfilesAllowed, true); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 // static | 231 // static |
232 bool UserSelectionScreen::ShouldForceOnlineSignIn( | 232 bool UserSelectionScreen::ShouldForceOnlineSignIn( |
233 const user_manager::User* user) { | 233 const user_manager::User* user) { |
234 // Public sessions are always allowed to log in offline. | 234 // Public sessions are always allowed to log in offline. |
235 // Supervised user are allowed to log in offline if their OAuth token status | 235 // Supervised users are always allowed to log in offline. |
236 // is unknown or valid. | |
237 // For all other users, force online sign in if: | 236 // For all other users, force online sign in if: |
238 // * The flag to force online sign-in is set for the user. | 237 // * The flag to force online sign-in is set for the user. |
239 // * The user's OAuth token is invalid. | 238 // * The user's OAuth token is invalid or unknown. |
240 // * The user's OAuth token status is unknown (except supervised users, | |
241 // see above). | |
242 if (user->is_logged_in()) | 239 if (user->is_logged_in()) |
243 return false; | 240 return false; |
244 | 241 |
245 const user_manager::User::OAuthTokenStatus token_status = | 242 const user_manager::User::OAuthTokenStatus token_status = |
246 user->oauth_token_status(); | 243 user->oauth_token_status(); |
247 const bool is_supervised_user = | 244 const bool is_supervised_user = |
248 user->GetType() == user_manager::USER_TYPE_SUPERVISED; | 245 user->GetType() == user_manager::USER_TYPE_SUPERVISED; |
249 const bool is_public_session = | 246 const bool is_public_session = |
250 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 247 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
251 | 248 |
252 if (is_supervised_user && | 249 if (is_supervised_user) |
253 token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN) { | |
254 return false; | 250 return false; |
255 } | |
256 | 251 |
257 if (is_public_session) | 252 if (is_public_session) |
258 return false; | 253 return false; |
259 | 254 |
260 // At this point the reason for invalid token should be already set. If not, | 255 // At this point the reason for invalid token should be already set. If not, |
261 // this might be a leftover from an old version. | 256 // this might be a leftover from an old version. |
262 if (token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID) | 257 if (token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID) |
263 RecordReauthReason(user->GetAccountId(), ReauthReason::OTHER); | 258 RecordReauthReason(user->GetAccountId(), ReauthReason::OTHER); |
264 | 259 |
265 return user->force_online_signin() || | 260 return user->force_online_signin() || |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 // The user profile should exist if and only if this is the lock screen. | 563 // The user profile should exist if and only if this is the lock screen. |
569 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 564 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
570 | 565 |
571 if (!profile) | 566 if (!profile) |
572 profile = profile_helper->GetSigninProfile(); | 567 profile = profile_helper->GetSigninProfile(); |
573 | 568 |
574 return EasyUnlockService::Get(profile); | 569 return EasyUnlockService::Get(profile); |
575 } | 570 } |
576 | 571 |
577 } // namespace chromeos | 572 } // namespace chromeos |
OLD | NEW |