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

Unified Diff: chrome/browser/usb/web_usb_permission_provider.cc

Issue 1316203006: Convert DeviceManagerDelegate to PermissionProvider mojo interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment and move ctor. Created 5 years, 3 months 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 | « chrome/browser/usb/web_usb_permission_provider.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/usb/web_usb_permission_provider.cc
diff --git a/chrome/browser/usb/web_usb_permission_provider.cc b/chrome/browser/usb/web_usb_permission_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0c86908bbe798598c0ef7e3cd2f305492217d851
--- /dev/null
+++ b/chrome/browser/usb/web_usb_permission_provider.cc
@@ -0,0 +1,38 @@
+// 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 "chrome/browser/usb/web_usb_permission_provider.h"
+
+#include "content/public/browser/browser_thread.h"
+
+// static
+void WebUSBPermissionProvider::Create(
+ content::RenderFrameHost* render_frame_host,
+ mojo::InterfaceRequest<PermissionProvider> request) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DCHECK(render_frame_host);
+
+ // The created object is strongly bound to (and owned by) the pipe.
+ new WebUSBPermissionProvider(render_frame_host, request.Pass());
+}
+
+WebUSBPermissionProvider::~WebUSBPermissionProvider() {}
+
+WebUSBPermissionProvider::WebUSBPermissionProvider(
+ content::RenderFrameHost* render_frame_host,
+ mojo::InterfaceRequest<PermissionProvider> request)
+ : binding_(this, request.Pass()),
+ render_frame_host_(render_frame_host) {}
+
+void WebUSBPermissionProvider::HasDevicePermission(
+ mojo::Array<mojo::String> requested_guids,
+ const HasDevicePermissionCallback& callback) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ // TODO(reillyg): Look up permissions granted to the render frame host's
+ // current origin in the render frame process's browser context. Until then
+ // |render_frame_host_| is unused so this ignore_result() is needed.
+ ignore_result(render_frame_host_);
+ mojo::Array<mojo::String> allowed_guids(0);
+ callback.Run(allowed_guids.Pass());
+}
« no previous file with comments | « chrome/browser/usb/web_usb_permission_provider.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698