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

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

Issue 11348220: sync: centralize sync startup decisions in TryStart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: take 2 Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // The TokenService will supply authentication tokens for any service that 5 // The TokenService will supply authentication tokens for any service that
6 // needs it, such as sync. Whenever the user logs in, a controller watching 6 // needs it, such as sync. Whenever the user logs in, a controller watching
7 // the token service is expected either to call ClientLogin to derive a new 7 // the token service is expected either to call ClientLogin to derive a new
8 // SID and LSID, or to use GAIA OAuth requests to derive an OAuth1 access 8 // SID and LSID, or to use GAIA OAuth requests to derive an OAuth1 access
9 // token for the OAuthLogin scope. Whenever such credentials are available, 9 // token for the OAuthLogin scope. Whenever such credentials are available,
10 // the TokenService should be updated with new credentials. The controller 10 // the TokenService should be updated with new credentials. The controller
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Terminate any running requests and reset the TokenService to a clean 137 // Terminate any running requests and reset the TokenService to a clean
138 // slate. Resets in memory structures. Does not modify the DB. 138 // slate. Resets in memory structures. Does not modify the DB.
139 // When this is done, no tokens will be left in memory and no 139 // When this is done, no tokens will be left in memory and no
140 // user credentials will be left. Useful if a user is logging out. 140 // user credentials will be left. Useful if a user is logging out.
141 // Initialize doesn't need to be called again but UpdateCredentials does. 141 // Initialize doesn't need to be called again but UpdateCredentials does.
142 void ResetCredentialsInMemory(); 142 void ResetCredentialsInMemory();
143 143
144 // Async load all tokens for services we know of from the DB. 144 // Async load all tokens for services we know of from the DB.
145 // You should do this at startup. Optionally you can do it again 145 // You should do this at startup. Optionally you can do it again
146 // after you reset in memory credentials. 146 // after you reset in memory credentials.
147 void LoadTokensFromDB(); 147 virtual void LoadTokensFromDB();
148 148
149 // Clear all DB stored tokens for the current profile. Tokens may still be 149 // Clear all DB stored tokens for the current profile. Tokens may still be
150 // available in memory. If a DB load is pending it may still be serviced. 150 // available in memory. If a DB load is pending it may still be serviced.
151 void EraseTokensFromDB(); 151 void EraseTokensFromDB();
152 152
153 // Returns true if tokens have been loaded from the DB. Set when 153 // Returns true if tokens have been loaded from the DB. Set when
154 // LoadTokensFromDB() completes, unset when ResetCredentialsInMemory() is 154 // LoadTokensFromDB() completes, unset when ResetCredentialsInMemory() is
155 // called. 155 // called.
156 bool TokensLoadedFromDB() const; 156 bool TokensLoadedFromDB() const;
157 157
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 const std::string& service, 189 const std::string& service,
190 const GoogleServiceAuthError& error) OVERRIDE; 190 const GoogleServiceAuthError& error) OVERRIDE;
191 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE; 191 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE;
192 virtual void OnClientOAuthFailure( 192 virtual void OnClientOAuthFailure(
193 const GoogleServiceAuthError& error) OVERRIDE; 193 const GoogleServiceAuthError& error) OVERRIDE;
194 194
195 // WebDataServiceConsumer implementation. 195 // WebDataServiceConsumer implementation.
196 virtual void OnWebDataServiceRequestDone( 196 virtual void OnWebDataServiceRequestDone(
197 WebDataService::Handle h, 197 WebDataService::Handle h,
198 const WDTypedResult* result) OVERRIDE; 198 const WDTypedResult* result) OVERRIDE;
199 protected:
Nicolas Zea 2012/11/29 19:43:08 newline above
tim (not reviewing) 2012/11/29 21:00:34 Done.
200 void set_tokens_loaded(bool loaded);
199 201
200 private: 202 private:
201 203
202 // Gets the list of all service names for which tokens will be retrieved. 204 // Gets the list of all service names for which tokens will be retrieved.
203 // This method is meant only for tests. 205 // This method is meant only for tests.
204 static void GetServiceNamesForTesting(std::vector<std::string>* names); 206 static void GetServiceNamesForTesting(std::vector<std::string>* names);
205 207
206 void FireCredentialsUpdatedNotification(const std::string& lsid, 208 void FireCredentialsUpdatedNotification(const std::string& lsid,
207 const std::string& sid); 209 const std::string& sid);
208 210
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 257
256 friend class TokenServiceTest; 258 friend class TokenServiceTest;
257 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); 259 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic);
258 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); 260 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced);
259 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); 261 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded);
260 262
261 DISALLOW_COPY_AND_ASSIGN(TokenService); 263 DISALLOW_COPY_AND_ASSIGN(TokenService);
262 }; 264 };
263 265
264 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ 266 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/token_service.cc » ('j') | chrome/browser/sync/profile_sync_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698