Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_USB_WEB_USB_PERMISSION_STORE_H_ | |
| 6 #define CHROME_BROWSER_USB_WEB_USB_PERMISSION_STORE_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <set> | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/scoped_observer.h" | |
| 14 #include "components/keyed_service/core/keyed_service.h" | |
| 15 #include "device/usb/usb_service.h" | |
| 16 #include "url/gurl.h" | |
|
Bernhard Bauer
2015/10/01 08:31:25
You could forward-declare GURL.
| |
| 17 | |
| 18 namespace content { | |
| 19 class BrowserContext; | |
| 20 } | |
| 21 | |
| 22 class HostContentSettingsMap; | |
| 23 | |
| 24 class WebUSBPermissionStore : public KeyedService, | |
|
raymes
2015/10/01 01:28:19
I'd feel more comfortable if we had a ChooserPermi
| |
| 25 public device::UsbService::Observer { | |
| 26 public: | |
| 27 static WebUSBPermissionStore* Get(content::BrowserContext* browser_context); | |
| 28 | |
| 29 explicit WebUSBPermissionStore(content::BrowserContext* browser_context); | |
| 30 ~WebUSBPermissionStore() override; | |
| 31 | |
| 32 void GrantDevicePermission(const GURL& origin, const std::string& guid); | |
| 33 void RevokeDevicePermission(const GURL& origin, const std::string& guid); | |
| 34 bool HasDevicePermission(const GURL& origin, const std::string& guid); | |
| 35 | |
| 36 private: | |
| 37 // device::UsbService::Observer implementation. | |
| 38 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; | |
| 39 | |
| 40 std::map<GURL, std::set<std::string>> ephemeral_devices_; | |
| 41 HostContentSettingsMap* host_content_settings_map_; | |
| 42 device::UsbService* usb_service_; | |
| 43 ScopedObserver<device::UsbService, device::UsbService::Observer> observer_; | |
| 44 }; | |
|
Ken Rockot(use gerrit already)
2015/10/01 01:26:32
nit: DISALLOW_COPY_AND_ASSIGN
| |
| 45 | |
| 46 #endif // CHROME_BROWSER_USB_WEB_USB_PERMISSION_STORE_H_ | |
| OLD | NEW |