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

Side by Side Diff: chrome/browser/signin/account_reconcilor.h

Issue 166433005: Add URL parameter so that /ListAccounts returns valid json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos compile error Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ 4 #ifndef CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_
5 #define CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ 5 #define CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_
6 6
7 #include <deque> 7 #include <deque>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 bool IsRegisteredWithTokenService() const { 51 bool IsRegisteredWithTokenService() const {
52 return registered_with_token_service_; 52 return registered_with_token_service_;
53 } 53 }
54 54
55 bool AreGaiaAccountsSet() const { return are_gaia_accounts_set_; } 55 bool AreGaiaAccountsSet() const { return are_gaia_accounts_set_; }
56 56
57 bool AreAllRefreshTokensChecked() const; 57 bool AreAllRefreshTokensChecked() const;
58 58
59 const std::vector<std::string>& GetGaiaAccountsForTesting() const { 59 const std::vector<std::pair<std::string, bool> >&
bartfab (slow) 2014/02/17 15:22:04 Nit 1: #include <string> Nit 2: #include <utility>
Roger Tawa OOO till Jul 10th 2014/02/18 19:37:54 Done.
60 GetGaiaAccountsForTesting() const {
60 return gaia_accounts_; 61 return gaia_accounts_;
61 } 62 }
62 63
64 private:
63 const std::set<std::string>& GetValidChromeAccountsForTesting() const { 65 const std::set<std::string>& GetValidChromeAccountsForTesting() const {
64 return valid_chrome_accounts_; 66 return valid_chrome_accounts_;
65 } 67 }
66 68
67 const std::set<std::string>& GetInvalidChromeAccountsForTesting() const { 69 const std::set<std::string>& GetInvalidChromeAccountsForTesting() const {
68 return invalid_chrome_accounts_; 70 return invalid_chrome_accounts_;
69 } 71 }
70 72
71 private:
72 // Used during GetAccountsFromCookie. 73 // Used during GetAccountsFromCookie.
73 // Stores a callback for the next action to perform. 74 // Stores a callback for the next action to perform.
74 typedef base::Callback<void( 75 typedef base::Callback<void(
75 const GoogleServiceAuthError& error, 76 const GoogleServiceAuthError& error,
76 const std::vector<std::string>&)> GetAccountsFromCookieCallback; 77 const std::vector<std::pair<std::string, bool> >&)>
78 GetAccountsFromCookieCallback;
77 79
78 friend class AccountReconcilorTest; 80 friend class AccountReconcilorTest;
79 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, GetAccountsFromCookieSuccess); 81 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, GetAccountsFromCookieSuccess);
80 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, GetAccountsFromCookieFailure); 82 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, GetAccountsFromCookieFailure);
81 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, ValidateAccountsFromTokens); 83 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, ValidateAccountsFromTokens);
82 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, 84 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
83 ValidateAccountsFromTokensFailedUserInfo); 85 ValidateAccountsFromTokensFailedUserInfo);
84 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, 86 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
85 ValidateAccountsFromTokensFailedTokenRequest); 87 ValidateAccountsFromTokensFailedTokenRequest);
86 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileNoop); 88 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileNoop);
87 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileNoopMultiple); 89 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileNoopMultiple);
88 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileAddToCookie); 90 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileAddToCookie);
89 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileAddToChrome); 91 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileAddToChrome);
90 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileBadPrimary); 92 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileBadPrimary);
91 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileOnlyOnce); 93 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, StartReconcileOnlyOnce);
94 FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
95 StartReconcileWithSessionInfoExpiredDefault);
92 96
93 class RefreshTokenFetcher; 97 class RefreshTokenFetcher;
94 class UserIdFetcher; 98 class UserIdFetcher;
95 99
96 // Register and unregister with dependent services. 100 // Register and unregister with dependent services.
97 void RegisterWithCookieMonster(); 101 void RegisterWithCookieMonster();
98 void UnregisterWithCookieMonster(); 102 void UnregisterWithCookieMonster();
99 void RegisterWithSigninManager(); 103 void RegisterWithSigninManager();
100 void UnregisterWithSigninManager(); 104 void UnregisterWithSigninManager();
101 void RegisterWithTokenService(); 105 void RegisterWithTokenService();
(...skipping 13 matching lines...) Expand all
115 virtual void PerformMergeAction(const std::string& account_id); 119 virtual void PerformMergeAction(const std::string& account_id);
116 virtual void PerformAddToChromeAction(const std::string& account_id, 120 virtual void PerformAddToChromeAction(const std::string& account_id,
117 int session_index); 121 int session_index);
118 virtual void PerformLogoutAllAccountsAction(); 122 virtual void PerformLogoutAllAccountsAction();
119 123
120 // Used to remove an account from chrome and the cookie jar. 124 // Used to remove an account from chrome and the cookie jar.
121 virtual void StartRemoveAction(const std::string& account_id); 125 virtual void StartRemoveAction(const std::string& account_id);
122 virtual void FinishRemoveAction( 126 virtual void FinishRemoveAction(
123 const std::string& account_id, 127 const std::string& account_id,
124 const GoogleServiceAuthError& error, 128 const GoogleServiceAuthError& error,
125 const std::vector<std::string>& accounts); 129 const std::vector<std::pair<std::string, bool> >& accounts);
126 130
127 // Used during periodic reconciliation. 131 // Used during periodic reconciliation.
128 void StartReconcile(); 132 void StartReconcile();
129 void FinishReconcile(); 133 void FinishReconcile();
130 void AbortReconcile(); 134 void AbortReconcile();
131 void CalculateIfReconcileIsDone(); 135 void CalculateIfReconcileIsDone();
132 void HandleSuccessfulAccountIdCheck(const std::string& account_id); 136 void HandleSuccessfulAccountIdCheck(const std::string& account_id);
133 void HandleFailedAccountIdCheck(const std::string& account_id); 137 void HandleFailedAccountIdCheck(const std::string& account_id);
134 void HandleRefreshTokenFetched(const std::string& account_id, 138 void HandleRefreshTokenFetched(const std::string& account_id,
135 const std::string& refresh_token); 139 const std::string& refresh_token);
136 140
137 void GetAccountsFromCookie(GetAccountsFromCookieCallback callback); 141 void GetAccountsFromCookie(GetAccountsFromCookieCallback callback);
138 void ContinueReconcileActionAfterGetGaiaAccounts( 142 void ContinueReconcileActionAfterGetGaiaAccounts(
139 const GoogleServiceAuthError& error, 143 const GoogleServiceAuthError& error,
140 const std::vector<std::string>& accounts); 144 const std::vector<std::pair<std::string, bool> >& accounts);
141 void ValidateAccountsFromTokenService(); 145 void ValidateAccountsFromTokenService();
142 146
143 void OnCookieChanged(ChromeCookieDetails* details); 147 void OnCookieChanged(ChromeCookieDetails* details);
144 148
145 // Overriden from content::NotificationObserver. 149 // Overriden from content::NotificationObserver.
146 virtual void Observe(int type, 150 virtual void Observe(int type,
147 const content::NotificationSource& source, 151 const content::NotificationSource& source,
148 const content::NotificationDetails& details) OVERRIDE; 152 const content::NotificationDetails& details) OVERRIDE;
149 153
150 // Overriden from GaiaAuthConsumer. 154 // Overriden from GaiaAuthConsumer.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 scoped_ptr<GaiaAuthFetcher> gaia_fetcher_; 188 scoped_ptr<GaiaAuthFetcher> gaia_fetcher_;
185 bool registered_with_token_service_; 189 bool registered_with_token_service_;
186 190
187 // True while the reconcilor is busy checking or managing the accounts in 191 // True while the reconcilor is busy checking or managing the accounts in
188 // this profile. 192 // this profile.
189 bool is_reconcile_started_; 193 bool is_reconcile_started_;
190 194
191 // Used during reconcile action. 195 // Used during reconcile action.
192 // These members are used used to validate the gaia cookie. 196 // These members are used used to validate the gaia cookie.
193 bool are_gaia_accounts_set_; 197 bool are_gaia_accounts_set_;
194 std::vector<std::string> gaia_accounts_; 198 std::vector<std::pair<std::string, bool> > gaia_accounts_;
195 199
196 // Used during reconcile action. 200 // Used during reconcile action.
197 // These members are used to validate the tokens in OAuth2TokenService. 201 // These members are used to validate the tokens in OAuth2TokenService.
198 std::string primary_account_; 202 std::string primary_account_;
199 std::vector<std::string> chrome_accounts_; 203 std::vector<std::string> chrome_accounts_;
200 scoped_ptr<OAuth2TokenService::Request>* requests_; 204 scoped_ptr<OAuth2TokenService::Request>* requests_;
201 ScopedVector<UserIdFetcher> user_id_fetchers_; 205 ScopedVector<UserIdFetcher> user_id_fetchers_;
202 ScopedVector<RefreshTokenFetcher> refresh_token_fetchers_; 206 ScopedVector<RefreshTokenFetcher> refresh_token_fetchers_;
203 std::set<std::string> valid_chrome_accounts_; 207 std::set<std::string> valid_chrome_accounts_;
204 std::set<std::string> invalid_chrome_accounts_; 208 std::set<std::string> invalid_chrome_accounts_;
205 std::vector<std::string> add_to_cookie_; 209 std::vector<std::string> add_to_cookie_;
206 std::vector<std::pair<std::string, int> > add_to_chrome_; 210 std::vector<std::pair<std::string, int> > add_to_chrome_;
207 211
208 std::deque<GetAccountsFromCookieCallback> get_gaia_accounts_callbacks_; 212 std::deque<GetAccountsFromCookieCallback> get_gaia_accounts_callbacks_;
209 213
210 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); 214 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor);
211 }; 215 };
212 216
213 #endif // CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ 217 #endif // CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698