| 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 MEDIA_MOJO_SERVICES_MOJO_PROVISION_FETCHER_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_PROVISION_FETCHER_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_PROVISION_FETCHER_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_PROVISION_FETCHER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 10 #include "media/base/android/provision_fetcher.h" | 11 #include "media/base/provision_fetcher.h" |
| 11 #include "media/mojo/interfaces/provision_fetcher.mojom.h" | 12 #include "media/mojo/interfaces/provision_fetcher.mojom.h" |
| 13 #include "media/mojo/services/media_mojo_export.h" |
| 12 | 14 |
| 13 namespace media { | 15 namespace media { |
| 14 | 16 |
| 15 // A ProvisionFetcher that proxies to a mojom::ProvisionFetcherPtr. | 17 // A ProvisionFetcher that proxies to a mojom::ProvisionFetcherPtr. |
| 16 class MojoProvisionFetcher : public ProvisionFetcher { | 18 class MEDIA_MOJO_EXPORT MojoProvisionFetcher |
| 19 : NON_EXPORTED_BASE(public ProvisionFetcher) { |
| 17 public: | 20 public: |
| 18 explicit MojoProvisionFetcher( | 21 explicit MojoProvisionFetcher( |
| 19 mojom::ProvisionFetcherPtr provision_fetcher_ptr); | 22 mojom::ProvisionFetcherPtr provision_fetcher_ptr); |
| 20 ~MojoProvisionFetcher() final; | 23 ~MojoProvisionFetcher() final; |
| 21 | 24 |
| 22 // ProvisionFetcher implementation: | 25 // ProvisionFetcher implementation: |
| 23 void Retrieve(const std::string& default_url, | 26 void Retrieve(const std::string& default_url, |
| 24 const std::string& request_data, | 27 const std::string& request_data, |
| 25 const ResponseCB& response_cb) final; | 28 const ResponseCB& response_cb) final; |
| 26 | 29 |
| 27 private: | 30 private: |
| 28 // Callback for mojom::ProvisionFetcherPtr::Retrieve(). | 31 // Callback for mojom::ProvisionFetcherPtr::Retrieve(). |
| 29 void OnResponse(const ResponseCB& response_cb, | 32 void OnResponse(const ResponseCB& response_cb, |
| 30 bool success, | 33 bool success, |
| 31 const std::string& response); | 34 const std::string& response); |
| 32 | 35 |
| 33 mojom::ProvisionFetcherPtr provision_fetcher_ptr_; | 36 mojom::ProvisionFetcherPtr provision_fetcher_ptr_; |
| 34 | 37 |
| 35 base::WeakPtrFactory<MojoProvisionFetcher> weak_factory_; | 38 base::WeakPtrFactory<MojoProvisionFetcher> weak_factory_; |
| 36 | 39 |
| 37 DISALLOW_COPY_AND_ASSIGN(MojoProvisionFetcher); | 40 DISALLOW_COPY_AND_ASSIGN(MojoProvisionFetcher); |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 } // namespace media | 43 } // namespace media |
| 41 | 44 |
| 42 #endif // MEDIA_MOJO_SERVICES_MOJO_PROVISION_FETCHER_H_ | 45 #endif // MEDIA_MOJO_SERVICES_MOJO_PROVISION_FETCHER_H_ |
| OLD | NEW |