diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-04 23:53:25 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-04 23:53:25 +0000 |
commit | 2a0ff28378173300b81b2874736c30a6c48d0029 (patch) | |
tree | 0eb6c0bab63a475a355f6ae73cea78219a789504 /google_apis/gaia/oauth2_access_token_fetcher.cc | |
parent | 64c15a3b3ac83e94f23c4e569e28f31bf95175ca (diff) | |
download | chromium_src-2a0ff28378173300b81b2874736c30a6c48d0029.zip chromium_src-2a0ff28378173300b81b2874736c30a6c48d0029.tar.gz chromium_src-2a0ff28378173300b81b2874736c30a6c48d0029.tar.bz2 |
Handling of multiple concurrent requests from different clients in OAuth2TokenService
BUG=268937
TEST=OAuth2TokenServiceTest.SameScopesRequestedForDifferentClients
TBR=tim (for chrome/browser/sync)
Review URL: https://chromiumcodereview.appspot.com/22581003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gaia/oauth2_access_token_fetcher.cc')
-rw-r--r-- | google_apis/gaia/oauth2_access_token_fetcher.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/google_apis/gaia/oauth2_access_token_fetcher.cc b/google_apis/gaia/oauth2_access_token_fetcher.cc index 456251f..9fd46d7 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher.cc +++ b/google_apis/gaia/oauth2_access_token_fetcher.cc @@ -56,13 +56,14 @@ static GoogleServiceAuthError CreateAuthError(URLRequestStatus status) { } } -static URLFetcher* CreateFetcher(URLRequestContextGetter* getter, +static URLFetcher* CreateFetcher(int id, + URLRequestContextGetter* getter, const GURL& url, const std::string& body, URLFetcherDelegate* delegate) { bool empty_body = body.empty(); URLFetcher* result = net::URLFetcher::Create( - 0, url, + id, url, empty_body ? URLFetcher::GET : URLFetcher::POST, delegate); @@ -82,6 +83,8 @@ static URLFetcher* CreateFetcher(URLRequestContextGetter* getter, } } // namespace +int OAuth2AccessTokenFetcher::last_fetcher_id_ = 0; + OAuth2AccessTokenFetcher::OAuth2AccessTokenFetcher( OAuth2AccessTokenConsumer* consumer, URLRequestContextGetter* getter) @@ -110,6 +113,7 @@ void OAuth2AccessTokenFetcher::StartGetAccessToken() { CHECK_EQ(INITIAL, state_); state_ = GET_ACCESS_TOKEN_STARTED; fetcher_.reset(CreateFetcher( + last_fetcher_id_++, getter_, MakeGetAccessTokenUrl(), MakeGetAccessTokenBody( @@ -231,3 +235,8 @@ bool OAuth2AccessTokenFetcher::ParseGetAccessTokenResponse( return dict->GetString(kAccessTokenKey, access_token) && dict->GetInteger(kExpiresInKey, expires_in); } + +// static +void OAuth2AccessTokenFetcher::ResetLastFetcherIdForTest() { + last_fetcher_id_ = 0; +} |