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

Unified Diff: chrome/common/net/gaia/oauth2_access_token_fetcher.h

Issue 8728038: Allow passing in a list of scopes to the access token fetcher class. (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
« no previous file with comments | « no previous file | chrome/common/net/gaia/oauth2_access_token_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/net/gaia/oauth2_access_token_fetcher.h
===================================================================
--- chrome/common/net/gaia/oauth2_access_token_fetcher.h (revision 112048)
+++ chrome/common/net/gaia/oauth2_access_token_fetcher.h (working copy)
@@ -43,13 +43,19 @@
class OAuth2AccessTokenFetcher : public content::URLFetcherDelegate {
public:
OAuth2AccessTokenFetcher(OAuth2AccessTokenConsumer* consumer,
- net::URLRequestContextGetter* getter,
- const std::string& source);
+ net::URLRequestContextGetter* getter);
virtual ~OAuth2AccessTokenFetcher();
+ // Starts the flow with the given parameters.
+ // |scopes| can be empty. If it is empty then the access token will have the
+ // same scope as the refresh token. If not empty, then access token will have
+ // the scopes specified. In this case, the access token will successfully be
+ // generated only if refresh token has login scope of a list of scopes that is
+ // a super-set of the specified scopes.
void Start(const std::string& client_id,
const std::string& client_secret,
- const std::string& refresh_token);
+ const std::string& refresh_token,
+ const std::vector<std::string>& scopes);
void CancelRequest();
@@ -74,16 +80,17 @@
// Other helpers.
static GURL MakeGetAccessTokenUrl();
- static std::string MakeGetAccessTokenBody(const std::string& client_id,
- const std::string& client_secret,
- const std::string& refresh_token);
+ static std::string MakeGetAccessTokenBody(
+ const std::string& client_id,
+ const std::string& client_secret,
+ const std::string& refresh_token,
+ const std::vector<std::string>& scopes);
static bool ParseGetAccessTokenResponse(const content::URLFetcher* source,
std::string* access_token);
// State that is set during construction.
OAuth2AccessTokenConsumer* const consumer_;
net::URLRequestContextGetter* const getter_;
- std::string source_;
State state_;
// While a fetch is in progress.
@@ -91,10 +98,13 @@
std::string client_id_;
std::string client_secret_;
std::string refresh_token_;
+ std::vector<std::string> scopes_;
friend class OAuth2AccessTokenFetcherTest;
FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest,
ParseGetAccessTokenResponse);
+ FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest,
+ MakeGetAccessTokenBody);
DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcher);
};
« no previous file with comments | « no previous file | chrome/common/net/gaia/oauth2_access_token_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698