Index: components/signin/core/browser/account_reconcilor.cc |
diff --git a/components/signin/core/browser/account_reconcilor.cc b/components/signin/core/browser/account_reconcilor.cc |
index 34738b74420ee52768d64d2452c45acf3b446e27..934458da1d24b04edd00f3d552bf55d521d4df7d 100644 |
--- a/components/signin/core/browser/account_reconcilor.cc |
+++ b/components/signin/core/browser/account_reconcilor.cc |
@@ -24,34 +24,23 @@ |
namespace { |
-class EmailEqualToFunc : public std::equal_to<gaia::ListedAccount> { |
+class AccountEqualToFunc : public std::equal_to<gaia::ListedAccount> { |
public: |
bool operator()(const gaia::ListedAccount& p1, |
const gaia::ListedAccount& p2) const; |
}; |
-bool EmailEqualToFunc::operator()( |
+bool AccountEqualToFunc::operator()( |
const gaia::ListedAccount& p1, |
const gaia::ListedAccount& p2) const { |
- return p1.valid == p2.valid && gaia::AreEmailsSame(p1.email, p2.email); |
+ return p1.valid == p2.valid && p1.id == p2.id; |
} |
-class AreEmailsSameFunc : public std::equal_to<std::string> { |
- public: |
- bool operator()(const std::string& p1, |
- const std::string& p2) const; |
-}; |
- |
-bool AreEmailsSameFunc::operator()( |
- const std::string& p1, |
- const std::string& p2) const { |
- return gaia::AreEmailsSame(p1, p2); |
-} |
- |
-gaia::ListedAccount AccountFromEmail(const std::string& email) { |
+gaia::ListedAccount AccountForId(const std::string& account_id) { |
gaia::ListedAccount account; |
- account.email = email; |
+ account.id = account_id; |
account.gaia_id = std::string(); |
+ account.email = std::string(); |
account.valid = true; |
return account; |
} |
@@ -339,19 +328,17 @@ void AccountReconcilor::FinishReconcile() { |
DCHECK(add_to_cookie_.empty()); |
int number_gaia_accounts = gaia_accounts_.size(); |
bool are_primaries_equal = number_gaia_accounts > 0 && |
- gaia::AreEmailsSame(primary_account_, gaia_accounts_[0].email); |
+ primary_account_ == gaia_accounts_[0].id; |
// If there are any accounts in the gaia cookie but not in chrome, then |
// those accounts need to be removed from the cookie. This means we need |
// to blow the cookie away. |
int removed_from_cookie = 0; |
for (size_t i = 0; i < gaia_accounts_.size(); ++i) { |
- const std::string& gaia_account = gaia_accounts_[i].email; |
if (gaia_accounts_[i].valid && |
- chrome_accounts_.end() == |
- std::find_if(chrome_accounts_.begin(), |
- chrome_accounts_.end(), |
- std::bind1st(AreEmailsSameFunc(), gaia_account))) { |
+ chrome_accounts_.end() == std::find(chrome_accounts_.begin(), |
+ chrome_accounts_.end(), |
+ gaia_accounts_[i].id)) { |
++removed_from_cookie; |
} |
} |
@@ -387,9 +374,8 @@ void AccountReconcilor::FinishReconcile() { |
if (gaia_accounts_.end() != |
std::find_if(gaia_accounts_.begin(), |
gaia_accounts_.end(), |
- std::bind1st(EmailEqualToFunc(), |
- AccountFromEmail(add_to_cookie_copy[i] |
- )))) { |
+ std::bind1st(AccountEqualToFunc(), |
+ AccountForId(add_to_cookie_copy[i])))) { |
cookie_manager_service_->SignalComplete( |
add_to_cookie_copy[i], |
GoogleServiceAuthError::AuthErrorNone()); |
@@ -398,9 +384,8 @@ void AccountReconcilor::FinishReconcile() { |
if (original_gaia_accounts.end() == |
std::find_if(original_gaia_accounts.begin(), |
original_gaia_accounts.end(), |
- std::bind1st(EmailEqualToFunc(), |
- AccountFromEmail(add_to_cookie_copy[i] |
- )))) { |
+ std::bind1st(AccountEqualToFunc(), |
+ AccountForId(add_to_cookie_copy[i])))) { |
added_to_cookie++; |
} |
} |