Chromium Code Reviews| 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/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 Loading... | |
| 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 CHECK_EQ(GetUserEmail(), user_id); | 496 const std::string user_email = GetUserEmail(); |
| 497 if (user_email.empty()) { | |
| 498 LOG(ERROR) << "Empty user email. Refresh token might go bad."; | |
| 499 return; | |
|
Tim Song
2015/05/21 00:06:46
We should run the callback with a failure.
xiyuan
2015/05/21 01:32:12
Good call. Done.
| |
| 500 } | |
| 501 | |
| 502 CHECK_EQ(user_email, user_id); | |
| 497 | 503 |
| 498 auth_attempt_.reset(new EasyUnlockAuthAttempt( | 504 auth_attempt_.reset(new EasyUnlockAuthAttempt( |
| 499 app_manager_.get(), user_id, | 505 app_manager_.get(), user_id, |
| 500 GetType() == TYPE_REGULAR ? EasyUnlockAuthAttempt::TYPE_UNLOCK | 506 GetType() == TYPE_REGULAR ? EasyUnlockAuthAttempt::TYPE_UNLOCK |
| 501 : EasyUnlockAuthAttempt::TYPE_SIGNIN, | 507 : EasyUnlockAuthAttempt::TYPE_SIGNIN, |
| 502 callback)); | 508 callback)); |
| 503 if (!auth_attempt_->Start()) | 509 if (!auth_attempt_->Start()) |
| 504 auth_attempt_.reset(); | 510 auth_attempt_.reset(); |
| 505 } | 511 } |
| 506 | 512 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 857 | 863 |
| 858 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt | 864 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt |
| 859 // failed. | 865 // failed. |
| 860 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) | 866 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) |
| 861 ->PrepareTpmKey(true /* check_private_key */, | 867 ->PrepareTpmKey(true /* check_private_key */, |
| 862 base::Closure()); | 868 base::Closure()); |
| 863 #endif // defined(OS_CHROMEOS) | 869 #endif // defined(OS_CHROMEOS) |
| 864 | 870 |
| 865 tpm_key_checked_ = true; | 871 tpm_key_checked_ = true; |
| 866 } | 872 } |
| OLD | NEW |