| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_PUBLIC_BROWSER_PROVISION_FETCHER_IMPL_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PROVISION_FETCHER_IMPL_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_PROVISION_FETCHER_IMPL_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PROVISION_FETCHER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "content/public/browser/provision_fetcher_factory.h" | 13 #include "content/public/browser/provision_fetcher_factory.h" |
| 14 #include "media/base/provision_fetcher.h" | 14 #include "media/base/provision_fetcher.h" |
| 15 #include "media/mojo/interfaces/provision_fetcher.mojom.h" | 15 #include "media/mojo/interfaces/provision_fetcher.mojom.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class URLRequestContextGetter; | 18 class URLRequestContextGetter; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace service_manager { |
| 22 struct BindSourceInfo; |
| 23 } |
| 24 |
| 21 namespace content { | 25 namespace content { |
| 22 | 26 |
| 23 // A media::mojom::ProvisionFetcher implementation based on | 27 // A media::mojom::ProvisionFetcher implementation based on |
| 24 // media::ProvisionFetcher. | 28 // media::ProvisionFetcher. |
| 25 class CONTENT_EXPORT ProvisionFetcherImpl | 29 class CONTENT_EXPORT ProvisionFetcherImpl |
| 26 : NON_EXPORTED_BASE(public media::mojom::ProvisionFetcher) { | 30 : NON_EXPORTED_BASE(public media::mojom::ProvisionFetcher) { |
| 27 public: | 31 public: |
| 28 static void Create(net::URLRequestContextGetter* context_getter, | 32 static void Create(net::URLRequestContextGetter* context_getter, |
| 33 const service_manager::BindSourceInfo& source_info, |
| 29 media::mojom::ProvisionFetcherRequest request); | 34 media::mojom::ProvisionFetcherRequest request); |
| 30 | 35 |
| 31 explicit ProvisionFetcherImpl( | 36 explicit ProvisionFetcherImpl( |
| 32 std::unique_ptr<media::ProvisionFetcher> provision_fetcher); | 37 std::unique_ptr<media::ProvisionFetcher> provision_fetcher); |
| 33 ~ProvisionFetcherImpl() override; | 38 ~ProvisionFetcherImpl() override; |
| 34 | 39 |
| 35 // media::mojom::ProvisionFetcher implementation. | 40 // media::mojom::ProvisionFetcher implementation. |
| 36 void Retrieve(const std::string& default_url, | 41 void Retrieve(const std::string& default_url, |
| 37 const std::string& request_data, | 42 const std::string& request_data, |
| 38 const RetrieveCallback& callback) final; | 43 const RetrieveCallback& callback) final; |
| 39 | 44 |
| 40 private: | 45 private: |
| 41 // Callback for media::ProvisionFetcher::Retrieve(). | 46 // Callback for media::ProvisionFetcher::Retrieve(). |
| 42 void OnResponse(const RetrieveCallback& callback, | 47 void OnResponse(const RetrieveCallback& callback, |
| 43 bool success, | 48 bool success, |
| 44 const std::string& response); | 49 const std::string& response); |
| 45 | 50 |
| 46 std::unique_ptr<media::ProvisionFetcher> provision_fetcher_; | 51 std::unique_ptr<media::ProvisionFetcher> provision_fetcher_; |
| 47 | 52 |
| 48 base::WeakPtrFactory<ProvisionFetcherImpl> weak_factory_; | 53 base::WeakPtrFactory<ProvisionFetcherImpl> weak_factory_; |
| 49 | 54 |
| 50 DISALLOW_COPY_AND_ASSIGN(ProvisionFetcherImpl); | 55 DISALLOW_COPY_AND_ASSIGN(ProvisionFetcherImpl); |
| 51 }; | 56 }; |
| 52 | 57 |
| 53 } // namespace content | 58 } // namespace content |
| 54 | 59 |
| 55 #endif // CONTENT_PUBLIC_BROWSER_PROVISION_FETCHER_IMPL_H_ | 60 #endif // CONTENT_PUBLIC_BROWSER_PROVISION_FETCHER_IMPL_H_ |
| OLD | NEW |