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

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 12207024: Crash fix for calling LoginUtilsImpl::RestoreAuthSession() during the main loop shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 FinalizePrepareProfile(ProfileManager::GetDefaultProfile()); 537 FinalizePrepareProfile(ProfileManager::GetDefaultProfile());
538 } 538 }
539 539
540 void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) { 540 void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) {
541 RestoreAuthSession(user_profile, has_web_auth_cookies_); 541 RestoreAuthSession(user_profile, has_web_auth_cookies_);
542 FinalizePrepareProfile(user_profile); 542 FinalizePrepareProfile(user_profile);
543 } 543 }
544 544
545 void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile, 545 void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile,
546 bool restore_from_auth_cookies) { 546 bool restore_from_auth_cookies) {
547 DCHECK(authenticator_ || !restore_from_auth_cookies); 547 CHECK((authenticator_ && authenticator_->authentication_profile()) ||
548 !restore_from_auth_cookies);
549 if (!login_manager_.get())
550 return;
551
548 // Remove legacy OAuth1 token if we have one. If it's valid, we should already 552 // Remove legacy OAuth1 token if we have one. If it's valid, we should already
549 // have OAuth2 refresh token in TokenService that could be used to retrieve 553 // have OAuth2 refresh token in TokenService that could be used to retrieve
550 // all other tokens and credentials. 554 // all other tokens and credentials.
551 login_manager_->RestoreSession( 555 login_manager_->RestoreSession(
552 user_profile, 556 user_profile,
553 authenticator_ ? 557 authenticator_ && authenticator_->authentication_profile() ?
554 authenticator_->authentication_profile()->GetRequestContext() : 558 authenticator_->authentication_profile()->GetRequestContext() :
555 NULL, 559 NULL,
556 restore_from_auth_cookies); 560 restore_from_auth_cookies);
557 } 561 }
558 562
559 void LoginUtilsImpl::FinalizePrepareProfile(Profile* user_profile) { 563 void LoginUtilsImpl::FinalizePrepareProfile(Profile* user_profile) {
560 BootTimesLoader* btl = BootTimesLoader::Get(); 564 BootTimesLoader* btl = BootTimesLoader::Get();
561 // Own TPM device if, for any reason, it has not been done in EULA 565 // Own TPM device if, for any reason, it has not been done in EULA
562 // wizard screen. 566 // wizard screen.
563 CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary(); 567 CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary();
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 bool LoginUtils::IsWhitelisted(const std::string& username) { 1043 bool LoginUtils::IsWhitelisted(const std::string& username) {
1040 CrosSettings* cros_settings = CrosSettings::Get(); 1044 CrosSettings* cros_settings = CrosSettings::Get();
1041 bool allow_new_user = false; 1045 bool allow_new_user = false;
1042 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 1046 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
1043 if (allow_new_user) 1047 if (allow_new_user)
1044 return true; 1048 return true;
1045 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 1049 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
1046 } 1050 }
1047 1051
1048 } // namespace chromeos 1052 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698