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