Index: chrome/browser/usb/web_usb_permission_store.h |
diff --git a/chrome/browser/usb/web_usb_permission_store.h b/chrome/browser/usb/web_usb_permission_store.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fd2dfefc3599cefed5048f95311704f8635ac4c3 |
--- /dev/null |
+++ b/chrome/browser/usb/web_usb_permission_store.h |
@@ -0,0 +1,46 @@ |
+// 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_STORE_H_ |
+#define CHROME_BROWSER_USB_WEB_USB_PERMISSION_STORE_H_ |
+ |
+#include <map> |
+#include <set> |
+#include <string> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/scoped_observer.h" |
+#include "components/keyed_service/core/keyed_service.h" |
+#include "device/usb/usb_service.h" |
+#include "url/gurl.h" |
Bernhard Bauer
2015/10/01 08:31:25
You could forward-declare GURL.
|
+ |
+namespace content { |
+class BrowserContext; |
+} |
+ |
+class HostContentSettingsMap; |
+ |
+class WebUSBPermissionStore : public KeyedService, |
raymes
2015/10/01 01:28:19
I'd feel more comfortable if we had a ChooserPermi
|
+ public device::UsbService::Observer { |
+ public: |
+ static WebUSBPermissionStore* Get(content::BrowserContext* browser_context); |
+ |
+ explicit WebUSBPermissionStore(content::BrowserContext* browser_context); |
+ ~WebUSBPermissionStore() override; |
+ |
+ void GrantDevicePermission(const GURL& origin, const std::string& guid); |
+ void RevokeDevicePermission(const GURL& origin, const std::string& guid); |
+ bool HasDevicePermission(const GURL& origin, const std::string& guid); |
+ |
+ private: |
+ // device::UsbService::Observer implementation. |
+ void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; |
+ |
+ std::map<GURL, std::set<std::string>> ephemeral_devices_; |
+ HostContentSettingsMap* host_content_settings_map_; |
+ device::UsbService* usb_service_; |
+ ScopedObserver<device::UsbService, device::UsbService::Observer> observer_; |
+}; |
Ken Rockot(use gerrit already)
2015/10/01 01:26:32
nit: DISALLOW_COPY_AND_ASSIGN
|
+ |
+#endif // CHROME_BROWSER_USB_WEB_USB_PERMISSION_STORE_H_ |