Chromium Code Reviews| 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 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 // The instance is not reusable, so for each Fetch(), the instance must be | 29 // The instance is not reusable, so for each Fetch(), the instance must be |
| 30 // re-created. Deleting the instance cancels inflight operation. | 30 // re-created. Deleting the instance cancels inflight operation. |
| 31 class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher, | 31 class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher, |
| 32 public OAuth2TokenService::Consumer, | 32 public OAuth2TokenService::Consumer, |
| 33 public net::URLFetcherDelegate { | 33 public net::URLFetcherDelegate { |
| 34 public: | 34 public: |
| 35 ArcBackgroundAuthCodeFetcher(Profile* profile, ArcAuthContext* context); | 35 ArcBackgroundAuthCodeFetcher(Profile* profile, ArcAuthContext* context); |
| 36 ~ArcBackgroundAuthCodeFetcher() override; | 36 ~ArcBackgroundAuthCodeFetcher() override; |
| 37 | 37 |
| 38 // Exposed for testing. | |
| 39 static std::string GetTokenExchangeEndpoint(); | |
|
Luis Héctor Chávez
2017/05/11 16:57:54
nit: add "ForTesting" suffix.
blundell
2017/05/12 09:09:32
Done.
| |
| 40 | |
| 38 // ArcAuthCodeFetcher: | 41 // ArcAuthCodeFetcher: |
| 39 void Fetch(const FetchCallback& callback) override; | 42 void Fetch(const FetchCallback& callback) override; |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 void ResetFetchers(); | 45 void ResetFetchers(); |
| 43 void OnPrepared(net::URLRequestContextGetter* request_context_getter); | 46 void OnPrepared(net::URLRequestContextGetter* request_context_getter); |
| 44 | 47 |
| 45 // OAuth2TokenService::Consumer: | 48 // OAuth2TokenService::Consumer: |
| 46 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 49 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 47 const std::string& access_token, | 50 const std::string& access_token, |
| (...skipping 18 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 |