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

Unified Diff: chrome/browser/signin/easy_unlock_auth_attempt.cc

Issue 1494153002: This CL replaces e-mail with AccountId in easy signin code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bugfix in original easy unlock code' Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/easy_unlock_auth_attempt.cc
diff --git a/chrome/browser/signin/easy_unlock_auth_attempt.cc b/chrome/browser/signin/easy_unlock_auth_attempt.cc
index a47c3e2a400c4e47e31727867284e0d3296cd764..fced5610512a14356dca1c623057cfbf4731d929 100644
--- a/chrome/browser/signin/easy_unlock_auth_attempt.cc
+++ b/chrome/browser/signin/easy_unlock_auth_attempt.cc
@@ -49,7 +49,7 @@ std::string UnwrapSecret(const std::string& wrapped_secret,
void DefaultAuthAttemptFinalizedHandler(
EasyUnlockAuthAttempt::Type auth_attempt_type,
bool success,
- const std::string& user_id,
+ const AccountId& account_id,
const std::string& key_secret,
const std::string& key_label) {
if (!proximity_auth::ScreenlockBridge::Get()->IsLocked())
@@ -59,7 +59,7 @@ void DefaultAuthAttemptFinalizedHandler(
case EasyUnlockAuthAttempt::TYPE_UNLOCK:
if (success) {
proximity_auth::ScreenlockBridge::Get()->lock_handler()->Unlock(
- user_id);
+ account_id);
} else {
proximity_auth::ScreenlockBridge::Get()->lock_handler()->EnableInput();
}
@@ -68,13 +68,13 @@ void DefaultAuthAttemptFinalizedHandler(
if (success) {
proximity_auth::ScreenlockBridge::Get()
->lock_handler()
- ->AttemptEasySignin(user_id, key_secret, key_label);
+ ->AttemptEasySignin(account_id, key_secret, key_label);
} else {
// Attempting signin with an empty secret is equivalent to canceling the
// attempt.
proximity_auth::ScreenlockBridge::Get()
->lock_handler()
- ->AttemptEasySignin(user_id, std::string(), std::string());
+ ->AttemptEasySignin(account_id, std::string(), std::string());
}
return;
}
@@ -84,12 +84,12 @@ void DefaultAuthAttemptFinalizedHandler(
EasyUnlockAuthAttempt::EasyUnlockAuthAttempt(
EasyUnlockAppManager* app_manager,
- const std::string& user_id,
+ const AccountId& account_id,
Type type,
const FinalizedCallback& finalized_callback)
: app_manager_(app_manager),
state_(STATE_IDLE),
- user_id_(user_id),
+ account_id_(account_id),
type_(type),
finalized_callback_(finalized_callback) {
if (finalized_callback_.is_null())
@@ -98,7 +98,7 @@ EasyUnlockAuthAttempt::EasyUnlockAuthAttempt(
EasyUnlockAuthAttempt::~EasyUnlockAuthAttempt() {
if (state_ == STATE_RUNNING)
- Cancel(user_id_);
+ Cancel(account_id_);
}
bool EasyUnlockAuthAttempt::Start() {
@@ -109,10 +109,10 @@ bool EasyUnlockAuthAttempt::Start() {
proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type =
proximity_auth::ScreenlockBridge::Get()->lock_handler()->GetAuthType(
- user_id_);
+ account_id_);
if (auth_type != proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) {
- Cancel(user_id_);
+ Cancel(account_id_);
return false;
}
@@ -128,47 +128,47 @@ bool EasyUnlockAuthAttempt::Start() {
if (!app_manager_->SendAuthAttemptEvent() &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) {
- Cancel(user_id_);
+ Cancel(account_id_);
return false;
}
return true;
}
-void EasyUnlockAuthAttempt::FinalizeUnlock(const std::string& user_id,
+void EasyUnlockAuthAttempt::FinalizeUnlock(const AccountId& account_id,
bool success) {
- if (state_ != STATE_RUNNING || user_id != user_id_)
+ if (state_ != STATE_RUNNING || account_id != account_id_)
return;
if (!proximity_auth::ScreenlockBridge::Get()->IsLocked())
return;
if (type_ != TYPE_UNLOCK) {
- Cancel(user_id_);
+ Cancel(account_id_);
return;
}
- finalized_callback_.Run(type_, success, user_id, std::string(),
+ finalized_callback_.Run(type_, success, account_id, std::string(),
std::string());
state_ = STATE_DONE;
}
-void EasyUnlockAuthAttempt::FinalizeSignin(const std::string& user_id,
+void EasyUnlockAuthAttempt::FinalizeSignin(const AccountId& account_id,
const std::string& wrapped_secret,
const std::string& raw_session_key) {
- if (state_ != STATE_RUNNING || user_id != user_id_)
+ if (state_ != STATE_RUNNING || account_id != account_id_)
return;
if (!proximity_auth::ScreenlockBridge::Get()->IsLocked())
return;
if (type_ != TYPE_SIGNIN) {
- Cancel(user_id_);
+ Cancel(account_id_);
return;
}
if (wrapped_secret.empty()) {
- Cancel(user_id_);
+ Cancel(account_id_);
return;
}
@@ -180,15 +180,15 @@ void EasyUnlockAuthAttempt::FinalizeSignin(const std::string& user_id,
#endif // defined(OS_CHROMEOS)
const bool kSuccess = true;
- finalized_callback_.Run(type_, kSuccess, user_id, unwrapped_secret,
+ finalized_callback_.Run(type_, kSuccess, account_id, unwrapped_secret,
key_label);
state_ = STATE_DONE;
}
-void EasyUnlockAuthAttempt::Cancel(const std::string& user_id) {
+void EasyUnlockAuthAttempt::Cancel(const AccountId& account_id) {
state_ = STATE_DONE;
const bool kFailure = false;
- finalized_callback_.Run(type_, kFailure, user_id, std::string(),
+ finalized_callback_.Run(type_, kFailure, account_id, std::string(),
std::string());
}
« no previous file with comments | « chrome/browser/signin/easy_unlock_auth_attempt.h ('k') | chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698