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

Side by Side Diff: chrome/browser/chromeos/login/screens/user_selection_screen.cc

Issue 2835473002: Chromad: Allow offline login. (Closed)
Patch Set: Add TryAuthenticateUser call 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
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 "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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // * The user's OAuth token is invalid or unknown. 327 // * The user's OAuth token is invalid or unknown.
328 if (user->is_logged_in()) 328 if (user->is_logged_in())
329 return false; 329 return false;
330 330
331 const user_manager::User::OAuthTokenStatus token_status = 331 const user_manager::User::OAuthTokenStatus token_status =
332 user->oauth_token_status(); 332 user->oauth_token_status();
333 const bool is_supervised_user = 333 const bool is_supervised_user =
334 user->GetType() == user_manager::USER_TYPE_SUPERVISED; 334 user->GetType() == user_manager::USER_TYPE_SUPERVISED;
335 const bool is_public_session = 335 const bool is_public_session =
336 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; 336 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT;
337 const bool has_gaia_account = user->HasGaiaAccount();
337 338
338 if (is_supervised_user) 339 if (is_supervised_user)
339 return false; 340 return false;
340 341
341 if (is_public_session) 342 if (is_public_session)
342 return false; 343 return false;
343 344
344 if (user->GetType() == user_manager::USER_TYPE_ACTIVE_DIRECTORY) {
345 return true;
346 }
347
348 // At this point the reason for invalid token should be already set. If not, 345 // At this point the reason for invalid token should be already set. If not,
349 // this might be a leftover from an old version. 346 // this might be a leftover from an old version.
350 if (token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID) 347 if (has_gaia_account &&
348 token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID)
351 RecordReauthReason(user->GetAccountId(), ReauthReason::OTHER); 349 RecordReauthReason(user->GetAccountId(), ReauthReason::OTHER);
352 350
353 // We need to force an online signin if the user is marked as requiring it, 351 // We need to force an online signin if the user is marked as requiring it,
354 // or if the user's session never completed initialization (still need to 352 // or if the user's session never completed initialization (still need to
355 // check for policy/management state) or if there's an invalid OAUTH token 353 // check for policy/management state) or if there's an invalid OAUTH token
356 // that needs to be refreshed. 354 // that needs to be refreshed.
357 return user->force_online_signin() || !user->profile_ever_initialized() || 355 return user->force_online_signin() || !user->profile_ever_initialized() ||
358 (token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID) || 356 (has_gaia_account &&
359 (token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN); 357 (token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID ||
358 token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN));
360 } 359 }
361 360
362 void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) { 361 void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) {
363 handler_ = handler; 362 handler_ = handler;
364 363
365 if (handler_) { 364 if (handler_) {
366 // Forcibly refresh all of the user images, as the |handler_| instance may 365 // Forcibly refresh all of the user images, as the |handler_| instance may
367 // have been reused. 366 // have been reused.
368 for (user_manager::User* user : users_) 367 for (user_manager::User* user : users_)
369 handler_->OnUserImageChanged(*user); 368 handler_->OnUserImageChanged(*user);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 // The user profile should exist if and only if this is the lock screen. 679 // The user profile should exist if and only if this is the lock screen.
681 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); 680 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN);
682 681
683 if (!profile) 682 if (!profile)
684 profile = profile_helper->GetSigninProfile(); 683 profile = profile_helper->GetSigninProfile();
685 684
686 return EasyUnlockService::Get(profile); 685 return EasyUnlockService::Get(profile);
687 } 686 }
688 687
689 } // namespace chromeos 688 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698