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

Unified Diff: chrome/browser/usb/web_usb_permission_bubble.h

Issue 1408193003: Add chrome side webusb permission UI code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address sky@'s comments, added TODO to chrome_bubble_manager.cc 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/usb/usb_tab_helper.cc ('k') | chrome/browser/usb/web_usb_permission_bubble.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/usb/web_usb_permission_bubble.h
diff --git a/chrome/browser/usb/web_usb_permission_bubble.h b/chrome/browser/usb/web_usb_permission_bubble.h
new file mode 100644
index 0000000000000000000000000000000000000000..1824754172d76ec15e4596fe652efdc49d850760
--- /dev/null
+++ b/chrome/browser/usb/web_usb_permission_bubble.h
@@ -0,0 +1,48 @@
+// 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.
+
+#ifndef CHROME_BROWSER_USB_WEB_USB_PERMISSION_BUBBLE_H_
+#define CHROME_BROWSER_USB_WEB_USB_PERMISSION_BUBBLE_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "components/bubble/bubble_reference.h"
+#include "components/webusb/public/interfaces/webusb_permission_bubble.mojom.h"
+#include "mojo/common/weak_binding_set.h"
+#include "mojo/public/cpp/bindings/array.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+
+namespace content {
+class RenderFrameHost;
+}
+
+namespace device {
+class UsbDevice;
+}
+
+// Implementation of the public webusb::WebUsbPermissionBubble interface.
+// This interface can be used by a webpage to request permission from user
+// to access a certain device.
+class ChromeWebUsbPermissionBubble : public webusb::WebUsbPermissionBubble {
+ public:
+ explicit ChromeWebUsbPermissionBubble(
+ content::RenderFrameHost* render_frame_host);
+
+ ~ChromeWebUsbPermissionBubble() override;
+
+ // webusb::WebUsbPermissionBubble:
+ void GetPermission(mojo::Array<device::usb::DeviceFilterPtr> device_filters,
+ const GetPermissionCallback& callback) override;
+ void Bind(mojo::InterfaceRequest<webusb::WebUsbPermissionBubble> request);
+
+ private:
+ content::RenderFrameHost* const render_frame_host_;
+ mojo::WeakBindingSet<webusb::WebUsbPermissionBubble> bindings_;
+ std::vector<BubbleReference> bubbles_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeWebUsbPermissionBubble);
+};
+
+#endif // CHROME_BROWSER_USB_WEB_USB_PERMISSION_BUBBLE_H_
« no previous file with comments | « chrome/browser/usb/usb_tab_helper.cc ('k') | chrome/browser/usb/web_usb_permission_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698