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

Side by Side Diff: chrome/browser/signin/easy_unlock_service.cc

Issue 1149873003: easy-unlock: Fix AttemptAuth email CHECK crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: run callback with failure Created 5 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
« no previous file with comments | « no previous file | chrome/browser/signin/easy_unlock_service_regular.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/signin/easy_unlock_service.h" 5 #include "chrome/browser/signin/easy_unlock_service.h"
6 6
7 #include "apps/app_lifetime_monitor.h" 7 #include "apps/app_lifetime_monitor.h"
8 #include "apps/app_lifetime_monitor_factory.h" 8 #include "apps/app_lifetime_monitor_factory.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 486
487 return handler->state(); 487 return handler->state();
488 } 488 }
489 489
490 void EasyUnlockService::AttemptAuth(const std::string& user_id) { 490 void EasyUnlockService::AttemptAuth(const std::string& user_id) {
491 AttemptAuth(user_id, AttemptAuthCallback()); 491 AttemptAuth(user_id, AttemptAuthCallback());
492 } 492 }
493 493
494 void EasyUnlockService::AttemptAuth(const std::string& user_id, 494 void EasyUnlockService::AttemptAuth(const std::string& user_id,
495 const AttemptAuthCallback& callback) { 495 const AttemptAuthCallback& callback) {
496 const EasyUnlockAuthAttempt::Type auth_attempt_type =
497 GetType() == TYPE_REGULAR ? EasyUnlockAuthAttempt::TYPE_UNLOCK
498 : EasyUnlockAuthAttempt::TYPE_SIGNIN;
499 const std::string user_email = GetUserEmail();
500 if (user_email.empty()) {
501 LOG(ERROR) << "Empty user email. Refresh token might go bad.";
502 if (!callback.is_null()) {
503 const bool kFailure = false;
504 callback.Run(auth_attempt_type, kFailure, user_id, std::string(),
505 std::string());
506 }
507 return;
508 }
509
496 CHECK_EQ(GetUserEmail(), user_id); 510 CHECK_EQ(GetUserEmail(), user_id);
497 511
498 auth_attempt_.reset(new EasyUnlockAuthAttempt( 512 auth_attempt_.reset(new EasyUnlockAuthAttempt(app_manager_.get(), user_id,
499 app_manager_.get(), user_id, 513 auth_attempt_type, callback));
500 GetType() == TYPE_REGULAR ? EasyUnlockAuthAttempt::TYPE_UNLOCK
501 : EasyUnlockAuthAttempt::TYPE_SIGNIN,
502 callback));
503 if (!auth_attempt_->Start()) 514 if (!auth_attempt_->Start())
504 auth_attempt_.reset(); 515 auth_attempt_.reset();
505 } 516 }
506 517
507 void EasyUnlockService::FinalizeUnlock(bool success) { 518 void EasyUnlockService::FinalizeUnlock(bool success) {
508 if (!auth_attempt_.get()) 519 if (!auth_attempt_.get())
509 return; 520 return;
510 521
511 this->OnWillFinalizeUnlock(success); 522 this->OnWillFinalizeUnlock(success);
512 auth_attempt_->FinalizeUnlock(GetUserEmail(), success); 523 auth_attempt_->FinalizeUnlock(GetUserEmail(), success);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 868
858 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt 869 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt
859 // failed. 870 // failed.
860 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) 871 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_)
861 ->PrepareTpmKey(true /* check_private_key */, 872 ->PrepareTpmKey(true /* check_private_key */,
862 base::Closure()); 873 base::Closure());
863 #endif // defined(OS_CHROMEOS) 874 #endif // defined(OS_CHROMEOS)
864 875
865 tpm_key_checked_ = true; 876 tpm_key_checked_ = true;
866 } 877 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/easy_unlock_service_regular.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698