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

Unified Diff: components/signin/core/browser/account_reconcilor.h

Issue 590113004: Handle account removal correctly on all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/signin/core/browser/account_reconcilor.h
diff --git a/components/signin/core/browser/account_reconcilor.h b/components/signin/core/browser/account_reconcilor.h
index 826618782ea19d9f7f82ef46df1a5a2bd015f529..8d52dde6ed5db3f7cb8adf72e6e92fe41dd37a9c 100644
--- a/components/signin/core/browser/account_reconcilor.h
+++ b/components/signin/core/browser/account_reconcilor.h
@@ -27,7 +27,6 @@
class GaiaAuthFetcher;
class ProfileOAuth2TokenService;
class SigninClient;
-class SigninOAuthHelper;
namespace net {
class CanonicalCookie;
@@ -36,7 +35,6 @@ class CanonicalCookie;
class AccountReconcilor : public KeyedService,
public GaiaAuthConsumer,
public MergeSessionHelper::Observer,
- public OAuth2TokenService::Consumer,
public OAuth2TokenService::Observer,
public SigninManagerBase::Observer {
public:
@@ -73,43 +71,17 @@ class AccountReconcilor : public KeyedService,
virtual void GetAccountsFromCookie(GetAccountsFromCookieCallback callback);
private:
- // An std::set<> for use with email addresses that uses
- // gaia::CanonicalizeEmail() during comparisons.
- // TODO(rogerta): this is a workaround for the fact that SigninManager and
- // SigninOAuthHelper use the gaia "email" property when adding accounts to
- // the token service, whereas gaia::ParseListAccountsData() returns email
- // addresses that have been passed through gaia::CanonicalizeEmail(). These
- // two types of email addresses are not directly comparable.
- class EmailLessFunc : public std::less<std::string> {
- public:
- bool operator()(const std::string& s1, const std::string& s2) const;
- };
- typedef std::set<std::string, EmailLessFunc> EmailSet;
-
- class RefreshTokenFetcher;
- class UserIdFetcher;
-
bool IsRegisteredWithTokenService() const {
return registered_with_token_service_;
}
bool AreGaiaAccountsSet() const { return are_gaia_accounts_set_; }
- bool AreAllRefreshTokensChecked() const;
-
const std::vector<std::pair<std::string, bool> >& GetGaiaAccountsForTesting()
const {
return gaia_accounts_;
}
- const EmailSet& GetValidChromeAccountsForTesting() const {
- return valid_chrome_accounts_;
- }
-
- const EmailSet& GetInvalidChromeAccountsForTesting() const {
- return invalid_chrome_accounts_;
- }
-
// Virtual so that it can be overridden in tests.
virtual void StartFetchingExternalCcResult();
@@ -119,18 +91,14 @@ class AccountReconcilor : public KeyedService,
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, ProfileAlreadyConnected);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, GetAccountsFromCookieSuccess);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, GetAccountsFromCookieFailure);
- FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, ValidateAccountsFromTokens);
- FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
- ValidateAccountsFromTokensFailedUserInfo);
- FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
- ValidateAccountsFromTokensFailedTokenRequest);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileNoop);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileNoopWithDots);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileNoopMultiple);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileAddToCookie);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
+ StartReconcileRemoveFromCookie);
+ FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
StartReconcileAddToCookieTwice);
- FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileAddToChrome);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileBadPrimary);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileOnlyOnce);
FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
@@ -148,26 +116,10 @@ class AccountReconcilor : public KeyedService,
bool IsProfileConnected();
- void DeleteFetchers();
-
// All actions with side effects. Virtual so that they can be overridden
// in tests.
virtual void PerformMergeAction(const std::string& account_id);
- virtual void PerformAddToChromeAction(
- const std::string& account_id,
- int session_index,
- const std::string& signin_scoped_device_id);
virtual void PerformLogoutAllAccountsAction();
- virtual void PerformAddAccountToTokenService(
- const std::string& account_id,
- const std::string& refresh_token);
-
- // Used to remove an account from chrome and the cookie jar.
- virtual void PerformStartRemoveAction(const std::string& account_id);
- virtual void PerformFinishRemoveAction(
- const std::string& account_id,
- const GoogleServiceAuthError& error,
- const std::vector<std::pair<std::string, bool> >& accounts);
// Used during periodic reconciliation.
void StartReconcile();
@@ -175,10 +127,6 @@ class AccountReconcilor : public KeyedService,
void AbortReconcile();
void CalculateIfReconcileIsDone();
void ScheduleStartReconcileIfChromeAccountsChanged();
- void HandleSuccessfulAccountIdCheck(const std::string& account_id);
- void HandleFailedAccountIdCheck(const std::string& account_id);
- void HandleRefreshTokenFetched(const std::string& account_id,
- const std::string& refresh_token);
void ContinueReconcileActionAfterGetGaiaAccounts(
const GoogleServiceAuthError& error,
@@ -186,8 +134,6 @@ class AccountReconcilor : public KeyedService,
void ValidateAccountsFromTokenService();
// Note internally that this |account_id| is added to the cookie jar.
bool MarkAccountAsAddedToCookie(const std::string& account_id);
- // Note internally that this |account_id| is added to the token service.
- void MarkAccountAsAddedToChrome(const std::string& account_id);
void OnCookieChanged(const net::CanonicalCookie* cookie);
@@ -201,15 +147,7 @@ class AccountReconcilor : public KeyedService,
const GoogleServiceAuthError& error)
OVERRIDE;
- // Overriden from OAuth2TokenService::Consumer.
- virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
- const std::string& access_token,
- const base::Time& expiration_time) OVERRIDE;
- virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
- const GoogleServiceAuthError& error) OVERRIDE;
-
// Overriden from OAuth2TokenService::Observer.
- virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE;
virtual void OnEndBatchChanges() OVERRIDE;
// Overriden from SigninManagerBase::Observer.
@@ -242,7 +180,7 @@ class AccountReconcilor : public KeyedService,
bool first_execution_;
// Used during reconcile action.
- // These members are used used to validate the gaia cookie. |gaia_accounts_|
+ // These members are used to validate the gaia cookie. |gaia_accounts_|
// holds the state of google accounts in the gaia cookie. Each element is
// a pair that holds the email address of the account and a boolean that
// indicates whether the account is valid or not. The accounts in the vector
@@ -254,13 +192,7 @@ class AccountReconcilor : public KeyedService,
// These members are used to validate the tokens in OAuth2TokenService.
std::string primary_account_;
std::vector<std::string> chrome_accounts_;
- scoped_ptr<OAuth2TokenService::Request>* requests_;
- ScopedVector<UserIdFetcher> user_id_fetchers_;
- ScopedVector<SigninOAuthHelper> refresh_token_fetchers_;
- EmailSet valid_chrome_accounts_;
- EmailSet invalid_chrome_accounts_;
std::vector<std::string> add_to_cookie_;
- std::vector<std::pair<std::string, int> > add_to_chrome_;
std::deque<GetAccountsFromCookieCallback> get_gaia_accounts_callbacks_;
« no previous file with comments | « chrome/browser/signin/account_reconcilor_unittest.cc ('k') | components/signin/core/browser/account_reconcilor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698