OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ | 4 #ifndef EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ |
5 #define EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ | 5 #define EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "extensions/common/permissions/api_permission.h" | 12 #include "extensions/common/permissions/api_permission.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 | 15 |
16 class Value; | 16 class Value; |
17 | 17 |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 | 21 |
(...skipping 16 matching lines...) Expand all Loading... |
38 UsbDevicePermissionData(); | 38 UsbDevicePermissionData(); |
39 UsbDevicePermissionData(uint16_t vendor_id, | 39 UsbDevicePermissionData(uint16_t vendor_id, |
40 uint16_t product_id, | 40 uint16_t product_id, |
41 int interface_id); | 41 int interface_id); |
42 | 42 |
43 // Check if |param| (which must be a UsbDevicePermissionData::CheckParam) | 43 // Check if |param| (which must be a UsbDevicePermissionData::CheckParam) |
44 // matches the vendor and product IDs associated with |this|. | 44 // matches the vendor and product IDs associated with |this|. |
45 bool Check(const APIPermission::CheckParam* param) const; | 45 bool Check(const APIPermission::CheckParam* param) const; |
46 | 46 |
47 // Convert |this| into a base::Value. | 47 // Convert |this| into a base::Value. |
48 scoped_ptr<base::Value> ToValue() const; | 48 std::unique_ptr<base::Value> ToValue() const; |
49 | 49 |
50 // Populate |this| from a base::Value. | 50 // Populate |this| from a base::Value. |
51 bool FromValue(const base::Value* value); | 51 bool FromValue(const base::Value* value); |
52 | 52 |
53 bool operator<(const UsbDevicePermissionData& rhs) const; | 53 bool operator<(const UsbDevicePermissionData& rhs) const; |
54 bool operator==(const UsbDevicePermissionData& rhs) const; | 54 bool operator==(const UsbDevicePermissionData& rhs) const; |
55 | 55 |
56 const uint16_t& vendor_id() const { return vendor_id_; } | 56 const uint16_t& vendor_id() const { return vendor_id_; } |
57 const uint16_t& product_id() const { return product_id_; } | 57 const uint16_t& product_id() const { return product_id_; } |
58 | 58 |
59 // These accessors are provided for IPC_STRUCT_TRAITS_MEMBER. Please | 59 // These accessors are provided for IPC_STRUCT_TRAITS_MEMBER. Please |
60 // think twice before using them for anything else. | 60 // think twice before using them for anything else. |
61 uint16_t& vendor_id() { return vendor_id_; } | 61 uint16_t& vendor_id() { return vendor_id_; } |
62 uint16_t& product_id() { return product_id_; } | 62 uint16_t& product_id() { return product_id_; } |
63 | 63 |
64 private: | 64 private: |
65 uint16_t vendor_id_; | 65 uint16_t vendor_id_; |
66 uint16_t product_id_; | 66 uint16_t product_id_; |
67 int interface_id_; | 67 int interface_id_; |
68 }; | 68 }; |
69 | 69 |
70 } // namespace extensions | 70 } // namespace extensions |
71 | 71 |
72 #endif // EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ | 72 #endif // EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ |
OLD | NEW |