| Index: chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h
|
| diff --git a/chrome/browser/chromeos/arc/arc_auth_code_fetcher.h b/chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h
|
| similarity index 65%
|
| rename from chrome/browser/chromeos/arc/arc_auth_code_fetcher.h
|
| rename to chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h
|
| index 19a2c18fdb3a9093d2d7e2ed3c121702e7ca3036..b7d41a89a888443c97fbab6d0e20c0364ffe3a34 100644
|
| --- a/chrome/browser/chromeos/arc/arc_auth_code_fetcher.h
|
| +++ b/chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.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 CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CODE_FETCHER_H_
|
| -#define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CODE_FETCHER_H_
|
| +#ifndef CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_
|
| +#define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_
|
|
|
| #include <memory>
|
| #include <string>
|
| @@ -12,6 +12,7 @@
|
| #include "base/macros.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "chrome/browser/chromeos/arc/arc_auth_context.h"
|
| +#include "chrome/browser/chromeos/arc/auth/arc_auth_code_fetcher.h"
|
| #include "google_apis/gaia/oauth2_token_service.h"
|
| #include "net/url_request/url_fetcher_delegate.h"
|
|
|
| @@ -26,16 +27,19 @@ namespace arc {
|
|
|
| // The instance is not reusable, so for each Fetch(), the instance must be
|
| // re-created. Deleting the instance cancels inflight operation.
|
| -class ArcAuthCodeFetcher : public OAuth2TokenService::Consumer,
|
| - public net::URLFetcherDelegate {
|
| +class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher,
|
| + public OAuth2TokenService::Consumer,
|
| + public net::URLFetcherDelegate {
|
| public:
|
| - ArcAuthCodeFetcher(Profile* profile, ArcAuthContext* context);
|
| - ~ArcAuthCodeFetcher() override;
|
| + ArcBackgroundAuthCodeFetcher(Profile* profile, ArcAuthContext* context);
|
| + ~ArcBackgroundAuthCodeFetcher() override;
|
|
|
| - // Starts to fetch the token. On success fetched |auth_token| is passed.
|
| - // On error, auth_token is empty.
|
| - using FetchCallback = base::Callback<void(const std::string& auth_token)>;
|
| - void Fetch(const FetchCallback& callback);
|
| + // ArcAuthCodeFetcher:
|
| + void Fetch(const FetchCallback& callback) override;
|
| +
|
| + private:
|
| + void ResetFetchers();
|
| + void OnPrepared(net::URLRequestContextGetter* request_context_getter);
|
|
|
| // OAuth2TokenService::Consumer:
|
| void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
|
| @@ -47,10 +51,6 @@ class ArcAuthCodeFetcher : public OAuth2TokenService::Consumer,
|
| // net::URLFetcherDelegate:
|
| void OnURLFetchComplete(const net::URLFetcher* source) override;
|
|
|
| - private:
|
| - void ResetFetchers();
|
| - void OnPrepared(net::URLRequestContextGetter* request_context_getter);
|
| -
|
| // Unowned pointers.
|
| Profile* const profile_;
|
| ArcAuthContext* const context_;
|
| @@ -61,11 +61,11 @@ class ArcAuthCodeFetcher : public OAuth2TokenService::Consumer,
|
| std::unique_ptr<OAuth2TokenService::Request> login_token_request_;
|
| std::unique_ptr<net::URLFetcher> auth_code_fetcher_;
|
|
|
| - base::WeakPtrFactory<ArcAuthCodeFetcher> weak_ptr_factory_;
|
| + base::WeakPtrFactory<ArcBackgroundAuthCodeFetcher> weak_ptr_factory_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(ArcAuthCodeFetcher);
|
| + DISALLOW_COPY_AND_ASSIGN(ArcBackgroundAuthCodeFetcher);
|
| };
|
|
|
| } // namespace arc
|
|
|
| -#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CODE_FETCHER_H_
|
| +#endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_
|
|
|