Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_PROVISION_FETCHER_IMPL_H_ | |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_PROVISION_FETCHER_IMPL_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "content/public/browser/android/provision_fetcher_factory.h" | |
| 12 #include "media/base/android/provision_fetcher.h" | |
| 13 #include "media/mojo/interfaces/provision_fetcher.mojom.h" | |
| 14 #include "mojo/public/cpp/bindings/strong_binding.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 class RenderFrameHost; | |
| 19 | |
| 20 // An media::interfaces::ProvisionFetcher implementation based on | |
| 21 // media::ProvisionFetcher. | |
| 22 class ProvisionFetcherImpl : public media::interfaces::ProvisionFetcher { | |
| 23 public: | |
| 24 static void Create( | |
| 25 RenderFrameHost* render_frame_host, | |
| 26 mojo::InterfaceRequest<media::interfaces::ProvisionFetcher> request); | |
| 27 | |
| 28 ProvisionFetcherImpl(scoped_ptr<media::ProvisionFetcher> provision_fetcher, | |
| 29 mojo::InterfaceRequest<ProvisionFetcher> request); | |
| 30 ~ProvisionFetcherImpl() override; | |
| 31 | |
| 32 // media::interfaces::ProvisionFetcher implementation. | |
| 33 void Retrieve(const mojo::String& default_url, | |
| 34 const mojo::String& request_data, | |
| 35 const RetrieveCallback& callback) final; | |
| 36 | |
| 37 private: | |
| 38 // Callback for media::ProvisionFetcher::Retrieve(). | |
| 39 void OnResponse(const RetrieveCallback& callback, | |
| 40 bool success, | |
| 41 const std::string& response); | |
| 42 | |
| 43 mojo::StrongBinding<media::interfaces::ProvisionFetcher> binding_; | |
| 44 scoped_ptr<media::ProvisionFetcher> provision_fetcher_; | |
|
xhwang
2015/11/20 22:28:34
rockot:
We have this "sandwich" model in many pla
| |
| 45 | |
| 46 base::WeakPtrFactory<ProvisionFetcherImpl> weak_factory_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(ProvisionFetcherImpl); | |
| 49 }; | |
| 50 | |
| 51 } // namespace content | |
| 52 | |
| 53 #endif // CONTENT_BROWSER_MEDIA_ANDROID_PROVISION_FETCHER_IMPL_H_ | |
| OLD | NEW |