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