Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: content/browser/media/android/provision_fetcher_impl.cc

Issue 1466633002: media: Add ProvisionFetcher mojo interface and implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix std::move use Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/media/android/provision_fetcher_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "content/browser/media/android/provision_fetcher_impl.h"
6
7 #include "content/public/browser/android/provision_fetcher_factory.h"
8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/render_process_host.h"
11 #include "net/url_request/url_request_context_getter.h"
12
13 namespace content {
14
15 // static
16 void ProvisionFetcherImpl::Create(
17 RenderFrameHost* render_frame_host,
18 mojo::InterfaceRequest<media::interfaces::ProvisionFetcher> request) {
19 net::URLRequestContextGetter* context_getter =
20 render_frame_host->GetProcess()->GetBrowserContext()->GetRequestContext();
21 DCHECK(context_getter);
22
23 // The created object is strongly bound to (and owned by) the pipe.
24 new ProvisionFetcherImpl(CreateProvisionFetcher(context_getter),
25 std::move(request));
26 }
27
28 ProvisionFetcherImpl::ProvisionFetcherImpl(
29 scoped_ptr<media::ProvisionFetcher> provision_fetcher,
30 mojo::InterfaceRequest<ProvisionFetcher> request)
31 : binding_(this, std::move(request)),
32 provision_fetcher_(std::move(provision_fetcher)),
33 weak_factory_(this) {
34 DVLOG(1) << __FUNCTION__;
35 }
36
37 ProvisionFetcherImpl::~ProvisionFetcherImpl() {}
38
39 void ProvisionFetcherImpl::Retrieve(const mojo::String& default_url,
40 const mojo::String& request_data,
41 const RetrieveCallback& callback) {
42 DVLOG(1) << __FUNCTION__ << ": " << default_url;
43 provision_fetcher_->Retrieve(
44 default_url, request_data,
45 base::Bind(&ProvisionFetcherImpl::OnResponse, weak_factory_.GetWeakPtr(),
46 callback));
47 }
48
49 void ProvisionFetcherImpl::OnResponse(const RetrieveCallback& callback,
50 bool success,
51 const std::string& response) {
52 DVLOG(1) << __FUNCTION__ << ": " << success;
53 callback.Run(success, response);
54 }
55
56 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/android/provision_fetcher_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698