| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/chromeos/arc/arc_auth_context.h" | 14 #include "chrome/browser/chromeos/arc/arc_auth_context.h" |
| 15 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" | 15 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" |
| 16 #include "chrome/browser/chromeos/arc/auth/arc_auth_code_fetcher.h" | 16 #include "chrome/browser/chromeos/arc/auth/arc_auth_code_fetcher.h" |
| 17 #include "google_apis/gaia/oauth2_token_service.h" | 17 #include "google_apis/gaia/oauth2_token_service.h" |
| 18 #include "net/url_request/url_fetcher_delegate.h" | 18 #include "net/url_request/url_fetcher_delegate.h" |
| 19 | 19 |
| 20 class Profile; | 20 class Profile; |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 class URLFetcher; | 23 class URLFetcher; |
| 24 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
| 25 } // namespace net | 25 } // namespace net |
| 26 | 26 |
| 27 namespace arc { | 27 namespace arc { |
| 28 | 28 |
| 29 // Exposed for testing. |
| 30 extern const char kAuthTokenExchangeEndPoint[]; |
| 31 |
| 29 // The instance is not reusable, so for each Fetch(), the instance must be | 32 // The instance is not reusable, so for each Fetch(), the instance must be |
| 30 // re-created. Deleting the instance cancels inflight operation. | 33 // re-created. Deleting the instance cancels inflight operation. |
| 31 class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher, | 34 class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher, |
| 32 public OAuth2TokenService::Consumer, | 35 public OAuth2TokenService::Consumer, |
| 33 public net::URLFetcherDelegate { | 36 public net::URLFetcherDelegate { |
| 34 public: | 37 public: |
| 35 ArcBackgroundAuthCodeFetcher(Profile* profile, ArcAuthContext* context); | 38 ArcBackgroundAuthCodeFetcher(Profile* profile, ArcAuthContext* context); |
| 36 ~ArcBackgroundAuthCodeFetcher() override; | 39 ~ArcBackgroundAuthCodeFetcher() override; |
| 37 | 40 |
| 38 // ArcAuthCodeFetcher: | 41 // ArcAuthCodeFetcher: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 66 std::unique_ptr<net::URLFetcher> auth_code_fetcher_; | 69 std::unique_ptr<net::URLFetcher> auth_code_fetcher_; |
| 67 | 70 |
| 68 base::WeakPtrFactory<ArcBackgroundAuthCodeFetcher> weak_ptr_factory_; | 71 base::WeakPtrFactory<ArcBackgroundAuthCodeFetcher> weak_ptr_factory_; |
| 69 | 72 |
| 70 DISALLOW_COPY_AND_ASSIGN(ArcBackgroundAuthCodeFetcher); | 73 DISALLOW_COPY_AND_ASSIGN(ArcBackgroundAuthCodeFetcher); |
| 71 }; | 74 }; |
| 72 | 75 |
| 73 } // namespace arc | 76 } // namespace arc |
| 74 | 77 |
| 75 #endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ | 78 #endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ |
| OLD | NEW |