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

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

Issue 16998003: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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
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 "base/chromeos/chromeos_version.h" 10 #include "base/chromeos/chromeos_version.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 FinalizePrepareProfile(ProfileManager::GetDefaultProfile()); 491 FinalizePrepareProfile(ProfileManager::GetDefaultProfile());
492 } 492 }
493 493
494 void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) { 494 void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) {
495 RestoreAuthSession(user_profile, has_web_auth_cookies_); 495 RestoreAuthSession(user_profile, has_web_auth_cookies_);
496 FinalizePrepareProfile(user_profile); 496 FinalizePrepareProfile(user_profile);
497 } 497 }
498 498
499 void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile, 499 void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile,
500 bool restore_from_auth_cookies) { 500 bool restore_from_auth_cookies) {
501 CHECK((authenticator_ && authenticator_->authentication_profile()) || 501 CHECK((authenticator_.get() && authenticator_->authentication_profile()) ||
502 !restore_from_auth_cookies); 502 !restore_from_auth_cookies);
503 if (!login_manager_.get()) 503 if (!login_manager_.get())
504 return; 504 return;
505 505
506 if (chrome::IsRunningInForcedAppMode()) 506 if (chrome::IsRunningInForcedAppMode())
507 return; 507 return;
508 508
509 UserManager::Get()->SetMergeSessionState( 509 UserManager::Get()->SetMergeSessionState(
510 UserManager::MERGE_STATUS_IN_PROCESS); 510 UserManager::MERGE_STATUS_IN_PROCESS);
511 511
512 // Remove legacy OAuth1 token if we have one. If it's valid, we should already 512 // Remove legacy OAuth1 token if we have one. If it's valid, we should already
513 // have OAuth2 refresh token in TokenService that could be used to retrieve 513 // have OAuth2 refresh token in TokenService that could be used to retrieve
514 // all other tokens and user_context. 514 // all other tokens and user_context.
515 login_manager_->RestoreSession( 515 login_manager_->RestoreSession(
516 user_profile, 516 user_profile,
517 authenticator_ && authenticator_->authentication_profile() ? 517 authenticator_.get() && authenticator_->authentication_profile()
518 authenticator_->authentication_profile()->GetRequestContext() : 518 ? authenticator_->authentication_profile()->GetRequestContext()
519 NULL, 519 : NULL,
520 session_restore_strategy_, 520 session_restore_strategy_,
521 oauth2_refresh_token_, 521 oauth2_refresh_token_,
522 user_context_.auth_code); 522 user_context_.auth_code);
523 } 523 }
524 524
525 void LoginUtilsImpl::FinalizePrepareProfile(Profile* user_profile) { 525 void LoginUtilsImpl::FinalizePrepareProfile(Profile* user_profile) {
526 BootTimesLoader* btl = BootTimesLoader::Get(); 526 BootTimesLoader* btl = BootTimesLoader::Get();
527 // Own TPM device if, for any reason, it has not been done in EULA 527 // Own TPM device if, for any reason, it has not been done in EULA
528 // wizard screen. 528 // wizard screen.
529 CryptohomeLibrary* cryptohome = CryptohomeLibrary::Get(); 529 CryptohomeLibrary* cryptohome = CryptohomeLibrary::Get();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 StringPrefMember language_preferred_languages; 715 StringPrefMember language_preferred_languages;
716 language_preferred_languages.Init(prefs::kLanguagePreferredLanguages, 716 language_preferred_languages.Init(prefs::kLanguagePreferredLanguages,
717 prefs); 717 prefs);
718 language_preferred_languages.SetValue(JoinString(language_codes, ',')); 718 language_preferred_languages.SetValue(JoinString(language_codes, ','));
719 } 719 }
720 720
721 scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator( 721 scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator(
722 LoginStatusConsumer* consumer) { 722 LoginStatusConsumer* consumer) {
723 // Screen locker needs new Authenticator instance each time. 723 // Screen locker needs new Authenticator instance each time.
724 if (ScreenLocker::default_screen_locker()) { 724 if (ScreenLocker::default_screen_locker()) {
725 if (authenticator_) 725 if (authenticator_.get())
726 authenticator_->SetConsumer(NULL); 726 authenticator_->SetConsumer(NULL);
727 authenticator_ = NULL; 727 authenticator_ = NULL;
728 } 728 }
729 729
730 if (authenticator_ == NULL) { 730 if (authenticator_.get() == NULL) {
731 authenticator_ = new ParallelAuthenticator(consumer); 731 authenticator_ = new ParallelAuthenticator(consumer);
732 } else { 732 } else {
733 // TODO(nkostylev): Fix this hack by improving Authenticator dependencies. 733 // TODO(nkostylev): Fix this hack by improving Authenticator dependencies.
734 authenticator_->SetConsumer(consumer); 734 authenticator_->SetConsumer(consumer);
735 } 735 }
736 return authenticator_; 736 return authenticator_;
737 } 737 }
738 738
739 // We use a special class for this so that it can be safely leaked if we 739 // We use a special class for this so that it can be safely leaked if we
740 // never connect. At shutdown the order is not well defined, and it's possible 740 // never connect. At shutdown the order is not well defined, and it's possible
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 bool LoginUtils::IsWhitelisted(const std::string& username) { 918 bool LoginUtils::IsWhitelisted(const std::string& username) {
919 CrosSettings* cros_settings = CrosSettings::Get(); 919 CrosSettings* cros_settings = CrosSettings::Get();
920 bool allow_new_user = false; 920 bool allow_new_user = false;
921 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 921 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
922 if (allow_new_user) 922 if (allow_new_user)
923 return true; 923 return true;
924 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 924 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
925 } 925 }
926 926
927 } // namespace chromeos 927 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_performer.cc ('k') | chrome/browser/chromeos/login/oauth2_login_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698