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