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