Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_USB_USB_CHOOSER_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_USB_USB_CHOOSER_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_USB_USB_CHOOSER_CONTEXT_H_ | 6 #define CHROME_BROWSER_USB_USB_CHOOSER_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 void GrantDevicePermission(const GURL& requesting_origin, | 42 void GrantDevicePermission(const GURL& requesting_origin, |
| 43 const GURL& embedding_origin, | 43 const GURL& embedding_origin, |
| 44 const std::string& guid); | 44 const std::string& guid); |
| 45 | 45 |
| 46 // Checks if |requesting_origin| (when embedded within |embedding_origin| has | 46 // Checks if |requesting_origin| (when embedded within |embedding_origin| has |
| 47 // access to a device with |device_info|. | 47 // access to a device with |device_info|. |
| 48 bool HasDevicePermission(const GURL& requesting_origin, | 48 bool HasDevicePermission(const GURL& requesting_origin, |
| 49 const GURL& embedding_origin, | 49 const GURL& embedding_origin, |
| 50 scoped_refptr<const device::UsbDevice> device); | 50 scoped_refptr<const device::UsbDevice> device); |
| 51 | 51 |
| 52 base::WeakPtr<UsbChooserContext> AsWeakPtr(); | |
|
msw
2017/03/13 23:48:51
optional nit: rename GetWeakPtr()?
Reilly Grant (use Gerrit)
2017/03/14 20:44:10
base::SupportsWeakPointer uses the name AsWeakPtr(
| |
| 53 | |
| 52 private: | 54 private: |
| 53 // ChooserContextBase implementation. | 55 // ChooserContextBase implementation. |
| 54 bool IsValidObject(const base::DictionaryValue& object) override; | 56 bool IsValidObject(const base::DictionaryValue& object) override; |
| 55 | 57 |
| 56 // device::UsbService::Observer implementation. | 58 // device::UsbService::Observer implementation. |
| 57 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; | 59 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; |
| 58 | 60 |
| 59 bool is_incognito_; | 61 bool is_incognito_; |
| 60 std::map<std::pair<GURL, GURL>, std::set<std::string>> ephemeral_devices_; | 62 std::map<std::pair<GURL, GURL>, std::set<std::string>> ephemeral_devices_; |
| 61 device::UsbService* usb_service_; | 63 device::UsbService* usb_service_; |
| 62 ScopedObserver<device::UsbService, device::UsbService::Observer> observer_; | 64 ScopedObserver<device::UsbService, device::UsbService::Observer> observer_; |
| 65 base::WeakPtrFactory<UsbChooserContext> weak_factory_; | |
| 63 | 66 |
| 64 DISALLOW_COPY_AND_ASSIGN(UsbChooserContext); | 67 DISALLOW_COPY_AND_ASSIGN(UsbChooserContext); |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 #endif // CHROME_BROWSER_USB_USB_CHOOSER_CONTEXT_H_ | 70 #endif // CHROME_BROWSER_USB_USB_CHOOSER_CONTEXT_H_ |
| OLD | NEW |