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