| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ | 4 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ |
| 5 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ | 5 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/common/extensions/permissions/api_permission.h" | 11 #include "chrome/common/extensions/permissions/api_permission.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 | 14 |
| 15 class Value; | 15 class Value; |
| 16 | 16 |
| 17 } // namespace base | 17 } // namespace base |
| 18 | 18 |
| 19 namespace extensions { | 19 namespace extensions { |
| 20 | 20 |
| 21 // A pattern that can be used to match a USB device permission. | 21 // A pattern that can be used to match a USB device permission. |
| 22 // Should be of the format: vendorId:productId, where both vendorId and | 22 // Should be of the format: vendorId:productId, where both vendorId and |
| 23 // productId are decimal strings representing uint16 values. | 23 // productId are decimal strings representing uint16 values. |
| 24 class UsbDevicePermissionData { | 24 class UsbDevicePermissionData { |
| 25 public: | 25 public: |
| 26 enum SpecialInterfaces { | 26 enum SpecialInterfaces { |
| 27 // A special interface id for stating permissions for an entire USB device, | 27 // A special interface id for stating permissions for an entire USB device, |
| 28 // no specific interface. This value must match value of Rule::ANY_INTERFACE | 28 // no specific interface. This value must match value of Rule::ANY_INTERFACE |
| 29 // from ChromeOS permission_broker project. | 29 // from ChromeOS permission_broker project. |
| 30 ANY_INTERFACE = -1 | 30 ANY_INTERFACE = -1, |
| 31 |
| 32 // A special interface id for |Check| to indicate that interface field is |
| 33 // not to be checked. Not used in manifest file. |
| 34 UNSPECIFIED_INTERFACE = -2 |
| 31 }; | 35 }; |
| 32 | 36 |
| 33 UsbDevicePermissionData(); | 37 UsbDevicePermissionData(); |
| 34 UsbDevicePermissionData(uint16 vendor_id, | 38 UsbDevicePermissionData(uint16 vendor_id, |
| 35 uint16 product_id, | 39 uint16 product_id, |
| 36 int interface_id); | 40 int interface_id); |
| 37 | 41 |
| 38 // Check if |param| (which must be a UsbDevicePermissionData::CheckParam) | 42 // Check if |param| (which must be a UsbDevicePermissionData::CheckParam) |
| 39 // matches the vendor and product IDs associated with |this|. | 43 // matches the vendor and product IDs associated with |this|. |
| 40 bool Check(const APIPermission::CheckParam* param) const; | 44 bool Check(const APIPermission::CheckParam* param) const; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 | 62 |
| 59 private: | 63 private: |
| 60 uint16 vendor_id_; | 64 uint16 vendor_id_; |
| 61 uint16 product_id_; | 65 uint16 product_id_; |
| 62 int interface_id_; | 66 int interface_id_; |
| 63 }; | 67 }; |
| 64 | 68 |
| 65 } // namespace extensions | 69 } // namespace extensions |
| 66 | 70 |
| 67 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ | 71 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ |
| OLD | NEW |