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

Unified Diff: chrome/browser/net/gaia/token_service.h

Issue 8734009: Revive reverted path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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: chrome/browser/net/gaia/token_service.h
===================================================================
--- chrome/browser/net/gaia/token_service.h (revision 112048)
+++ chrome/browser/net/gaia/token_service.h (working copy)
@@ -51,6 +51,7 @@
#include "content/public/browser/notification_registrar.h"
class Profile;
+class TokenServiceTest;
namespace net {
class URLRequestContextGetter;
@@ -155,6 +156,14 @@
virtual bool HasTokenForService(const char* service) const;
const std::string& GetTokenForService(const char* const service) const;
+ // OAuth login token is an all-powerful token that allows creating OAuth2
+ // tokens for any other scope (i.e. down-scoping).
+ // Typical use is to create an OAuth2 token for appropriate scope and then
+ // use that token to call a Google API.
+ virtual bool HasOAuthLoginToken() const;
+ const std::string& GetOAuth2LoginRefreshToken() const;
+ const std::string& GetOAuth2LoginAccessToken() const;
+
// For tests only. Doesn't save to the WebDB.
void IssueAuthTokenForTest(const std::string& service,
const std::string& auth_token);
@@ -165,6 +174,11 @@
virtual void OnIssueAuthTokenFailure(
const std::string& service,
const GoogleServiceAuthError& error) OVERRIDE;
+ virtual void OnOAuthLoginTokenSuccess(const std::string& refresh_token,
+ const std::string& access_token,
+ int expires_in_secs) OVERRIDE;
+ virtual void OnOAuthLoginTokenFailure(const GoogleServiceAuthError& error)
+ OVERRIDE;
// GaiaOAuthConsumer implementation.
virtual void OnOAuthGetAccessTokenSuccess(const std::string& token,
@@ -197,12 +211,20 @@
void FireTokenRequestFailedNotification(const std::string& service,
const GoogleServiceAuthError& error);
- void LoadTokensIntoMemory(const std::map<std::string, std::string>& in_toks,
- std::map<std::string, std::string>* out_toks);
+ void LoadTokensIntoMemory(
+ const std::map<std::string, std::string>& db_tokens,
+ std::map<std::string, std::string>* in_memory_tokens);
+ void LoadSingleTokenIntoMemory(
+ const std::map<std::string, std::string>& db_tokens,
+ std::map<std::string, std::string>* in_memory_tokens,
+ const std::string& service);
void SaveAuthTokenToDB(const std::string& service,
const std::string& auth_token);
+ // Returns the index of the given service.
+ static int GetServiceIndex(const std::string& service);
+
// The profile with which this instance was initialized, or NULL.
Profile* profile_;
@@ -252,6 +274,7 @@
content::NotificationRegistrar registrar_;
+ friend class TokenServiceTest;
FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic);
FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced);
FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded);
« no previous file with comments | « chrome/browser/extensions/app_notify_channel_setup_unittest.cc ('k') | chrome/browser/net/gaia/token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698