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

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

Issue 10656033: [sync] Automatic bootstrapping of Sync on Win 8 from cached credentials (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fully decouple PSS and CCS. Created 8 years, 4 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 (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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 TokenRequestFailedDetails(const std::string& service, 87 TokenRequestFailedDetails(const std::string& service,
88 const GoogleServiceAuthError& error) 88 const GoogleServiceAuthError& error)
89 : service_(service), error_(error) {} 89 : service_(service), error_(error) {}
90 const std::string& service() const { return service_; } 90 const std::string& service() const { return service_; }
91 const GoogleServiceAuthError& error() const { return error_; } 91 const GoogleServiceAuthError& error() const { return error_; }
92 private: 92 private:
93 std::string service_; 93 std::string service_;
94 GoogleServiceAuthError error_; 94 GoogleServiceAuthError error_;
95 }; 95 };
96 96
97 class CredentialsUpdatedDetails {
98 public:
99 CredentialsUpdatedDetails() {}
Andrew T Wilson (Slow) 2012/07/24 20:57:41 Do we need this default constructor? Seems illegal
Raghu Simha 2012/07/24 22:17:35 Removed.
100 CredentialsUpdatedDetails(const std::string& lsid,
101 const std::string& sid)
102 : lsid_(lsid), sid_(sid) {}
103 const std::string& lsid() const { return lsid_; }
104 const std::string& sid() const { return sid_; }
105 private:
106 std::string lsid_;
107 std::string sid_;
108 };
109
97 // Initialize this token service with a request source 110 // Initialize this token service with a request source
98 // (usually from a GaiaAuthConsumer constant), and the profile. 111 // (usually from a GaiaAuthConsumer constant), and the profile.
99 // Typically you'd then update the credentials. 112 // Typically you'd then update the credentials.
100 void Initialize(const char* const source, Profile* profile); 113 void Initialize(const char* const source, Profile* profile);
101 114
102 // Used to determine whether Initialize() has been called. 115 // Used to determine whether Initialize() has been called.
103 bool Initialized() const { return !source_.empty(); } 116 bool Initialized() const { return !source_.empty(); }
104 117
105 // Update ClientLogin credentials in the token service. 118 // Update ClientLogin credentials in the token service.
106 // Afterwards you can StartFetchingTokens. 119 // Afterwards you can StartFetchingTokens.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 virtual void Observe(int type, 188 virtual void Observe(int type,
176 const content::NotificationSource& source, 189 const content::NotificationSource& source,
177 const content::NotificationDetails& details) OVERRIDE; 190 const content::NotificationDetails& details) OVERRIDE;
178 191
179 private: 192 private:
180 193
181 // Gets the list of all service names for which tokens will be retrieved. 194 // Gets the list of all service names for which tokens will be retrieved.
182 // This method is meant only for tests. 195 // This method is meant only for tests.
183 static void GetServiceNamesForTesting(std::vector<std::string>* names); 196 static void GetServiceNamesForTesting(std::vector<std::string>* names);
184 197
198 void FireCredentialsUpdatedNotification(const std::string& lsid,
199 const std::string& sid);
200
185 void FireTokenAvailableNotification(const std::string& service, 201 void FireTokenAvailableNotification(const std::string& service,
186 const std::string& auth_token); 202 const std::string& auth_token);
187 203
188 void FireTokenRequestFailedNotification(const std::string& service, 204 void FireTokenRequestFailedNotification(const std::string& service,
189 const GoogleServiceAuthError& error); 205 const GoogleServiceAuthError& error);
190 206
191 void LoadTokensIntoMemory( 207 void LoadTokensIntoMemory(
192 const std::map<std::string, std::string>& db_tokens, 208 const std::map<std::string, std::string>& db_tokens,
193 std::map<std::string, std::string>* in_memory_tokens); 209 std::map<std::string, std::string>* in_memory_tokens);
194 void LoadSingleTokenIntoMemory( 210 void LoadSingleTokenIntoMemory(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 249
234 friend class TokenServiceTest; 250 friend class TokenServiceTest;
235 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); 251 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic);
236 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); 252 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced);
237 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); 253 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded);
238 254
239 DISALLOW_COPY_AND_ASSIGN(TokenService); 255 DISALLOW_COPY_AND_ASSIGN(TokenService);
240 }; 256 };
241 257
242 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ 258 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698