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

Unified 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, 1 month 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/android/provision_fetcher_impl.cc
diff --git a/content/browser/media/android/provision_fetcher_impl.cc b/content/browser/media/android/provision_fetcher_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8e9f689d5e2edccd9329a21ad34dc9920c62e92f
--- /dev/null
+++ b/content/browser/media/android/provision_fetcher_impl.cc
@@ -0,0 +1,56 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/media/android/provision_fetcher_impl.h"
+
+#include "content/public/browser/android/provision_fetcher_factory.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
+#include "net/url_request/url_request_context_getter.h"
+
+namespace content {
+
+// static
+void ProvisionFetcherImpl::Create(
+ RenderFrameHost* render_frame_host,
+ mojo::InterfaceRequest<media::interfaces::ProvisionFetcher> request) {
+ net::URLRequestContextGetter* context_getter =
+ render_frame_host->GetProcess()->GetBrowserContext()->GetRequestContext();
+ DCHECK(context_getter);
+
+ // The created object is strongly bound to (and owned by) the pipe.
+ new ProvisionFetcherImpl(CreateProvisionFetcher(context_getter),
+ std::move(request));
+}
+
+ProvisionFetcherImpl::ProvisionFetcherImpl(
+ scoped_ptr<media::ProvisionFetcher> provision_fetcher,
+ mojo::InterfaceRequest<ProvisionFetcher> request)
+ : binding_(this, std::move(request)),
+ provision_fetcher_(std::move(provision_fetcher)),
+ weak_factory_(this) {
+ DVLOG(1) << __FUNCTION__;
+}
+
+ProvisionFetcherImpl::~ProvisionFetcherImpl() {}
+
+void ProvisionFetcherImpl::Retrieve(const mojo::String& default_url,
+ const mojo::String& request_data,
+ const RetrieveCallback& callback) {
+ DVLOG(1) << __FUNCTION__ << ": " << default_url;
+ provision_fetcher_->Retrieve(
+ default_url, request_data,
+ base::Bind(&ProvisionFetcherImpl::OnResponse, weak_factory_.GetWeakPtr(),
+ callback));
+}
+
+void ProvisionFetcherImpl::OnResponse(const RetrieveCallback& callback,
+ bool success,
+ const std::string& response) {
+ DVLOG(1) << __FUNCTION__ << ": " << success;
+ callback.Run(success, response);
+}
+
+} // namespace content
« 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