| Index: google_apis/gaia/oauth2_access_token_fetcher_impl.h
|
| diff --git a/google_apis/gaia/oauth2_access_token_fetcher.h b/google_apis/gaia/oauth2_access_token_fetcher_impl.h
|
| similarity index 64%
|
| copy from google_apis/gaia/oauth2_access_token_fetcher.h
|
| copy to google_apis/gaia/oauth2_access_token_fetcher_impl.h
|
| index 90805c0996353a28d5c118e1403ec6071946c657..1b2e63068a51c9c5a9f2c3d3c3a3e1e8209e9d80 100644
|
| --- a/google_apis/gaia/oauth2_access_token_fetcher.h
|
| +++ b/google_apis/gaia/oauth2_access_token_fetcher_impl.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_
|
| -#define GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_
|
| +#ifndef GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMPL_H_
|
| +#define GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMPL_H_
|
|
|
| #include <string>
|
| #include <vector>
|
| @@ -11,10 +11,11 @@
|
| #include "base/gtest_prod_util.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "google_apis/gaia/oauth2_access_token_consumer.h"
|
| +#include "google_apis/gaia/oauth2_access_token_fetcher.h"
|
| #include "net/url_request/url_fetcher_delegate.h"
|
| #include "url/gurl.h"
|
|
|
| -class OAuth2AccessTokenFetcherTest;
|
| +class OAuth2AccessTokenFetcherImplTest;
|
|
|
| namespace base {
|
| class Time;
|
| @@ -44,24 +45,20 @@ class URLRequestStatus;
|
| //
|
| // This class can handle one request at a time. To parallelize requests,
|
| // create multiple instances.
|
| -class OAuth2AccessTokenFetcher : public net::URLFetcherDelegate {
|
| +class OAuth2AccessTokenFetcherImpl : public OAuth2AccessTokenFetcher,
|
| + public net::URLFetcherDelegate {
|
| public:
|
| - OAuth2AccessTokenFetcher(OAuth2AccessTokenConsumer* consumer,
|
| - 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.
|
| + OAuth2AccessTokenFetcherImpl(OAuth2AccessTokenConsumer* consumer,
|
| + net::URLRequestContextGetter* getter);
|
| + virtual ~OAuth2AccessTokenFetcherImpl();
|
| +
|
| + // Implementation of OAuth2AccessTokenFetcher
|
| virtual void Start(const std::string& client_id,
|
| const std::string& client_secret,
|
| const std::string& refresh_token,
|
| - const std::vector<std::string>& scopes);
|
| + const std::vector<std::string>& scopes) OVERRIDE;
|
|
|
| - void CancelRequest();
|
| + virtual void CancelRequest() OVERRIDE;
|
|
|
| // Implementation of net::URLFetcherDelegate
|
| virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
|
| @@ -91,17 +88,14 @@ class OAuth2AccessTokenFetcher : public net::URLFetcherDelegate {
|
| const std::string& refresh_token,
|
| const std::vector<std::string>& scopes);
|
|
|
| - static bool ParseGetAccessTokenSuccessResponse(
|
| - const net::URLFetcher* source,
|
| - std::string* access_token,
|
| - int* expires_in);
|
| + static bool ParseGetAccessTokenSuccessResponse(const net::URLFetcher* source,
|
| + std::string* access_token,
|
| + int* expires_in);
|
|
|
| - static bool ParseGetAccessTokenFailureResponse(
|
| - const net::URLFetcher* source,
|
| - std::string* error);
|
| + static bool ParseGetAccessTokenFailureResponse(const net::URLFetcher* source,
|
| + std::string* error);
|
|
|
| // State that is set during construction.
|
| - OAuth2AccessTokenConsumer* const consumer_;
|
| net::URLRequestContextGetter* const getter_;
|
| State state_;
|
|
|
| @@ -112,13 +106,13 @@ class OAuth2AccessTokenFetcher : public net::URLFetcherDelegate {
|
| std::string refresh_token_;
|
| std::vector<std::string> scopes_;
|
|
|
| - friend class OAuth2AccessTokenFetcherTest;
|
| - FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest,
|
| + friend class OAuth2AccessTokenFetcherImplTest;
|
| + FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherImplTest,
|
| ParseGetAccessTokenResponse);
|
| - FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest,
|
| + FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherImplTest,
|
| MakeGetAccessTokenBody);
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcher);
|
| + DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcherImpl);
|
| };
|
|
|
| -#endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_
|
| +#endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMPL_H_
|
|
|