Chromium Code Reviews| Index: chrome/browser/usb/usb_permission_context.h |
| diff --git a/chrome/browser/usb/usb_permission_context.h b/chrome/browser/usb/usb_permission_context.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5edff89e9e5aafdacd87b7108a7e76ba30dca665 |
| --- /dev/null |
| +++ b/chrome/browser/usb/usb_permission_context.h |
| @@ -0,0 +1,43 @@ |
| +// 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_USB_PERMISSION_CONTEXT_H_ |
| +#define CHROME_BROWSER_USB_USB_PERMISSION_CONTEXT_H_ |
| + |
| +#include <map> |
| +#include <set> |
| +#include <string> |
| + |
| +#include "base/scoped_observer.h" |
| +#include "chrome/browser/permissions/chooser_permission_context_base.h" |
| +#include "device/usb/usb_service.h" |
| + |
| +class HostContentSettingsMap; |
| + |
| +class UsbPermissionContext : public ChooserPermissionContextBase, |
| + public device::UsbService::Observer { |
| + public: |
| + explicit UsbPermissionContext(Profile* profile); |
|
raymes
2015/10/06 05:28:20
For thought: Would it be possible to implement thi
Reilly Grant (use Gerrit)
2015/10/06 20:45:30
Each chooser permission may define the properties
|
| + ~UsbPermissionContext() 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); |
| + |
| + protected: |
| + bool IsRestrictedToSecureOrigins() const override; |
| + |
| + private: |
| + // device::UsbService::Observer implementation. |
| + void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; |
| + |
| + HostContentSettingsMap* host_content_settings_map_; |
| + std::map<GURL, std::set<std::string>> ephemeral_devices_; |
| + device::UsbService* usb_service_; |
| + ScopedObserver<device::UsbService, device::UsbService::Observer> observer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(UsbPermissionContext); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_USB_USB_PERMISSION_CONTEXT_H_ |