diff options
author | avi <avi@chromium.org> | 2015-12-01 11:27:07 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-01 19:35:33 +0000 |
commit | 6516805e8c69ac65bcb7d52a2a208be97a7d2a50 (patch) | |
tree | 0d67ff4a6fa2fe00b7dc5c51895b162599bab1f3 /extensions/common | |
parent | e5bfeba55d3d80aa4f5c8385ede94853789b0a9a (diff) | |
download | chromium_src-6516805e8c69ac65bcb7d52a2a208be97a7d2a50.zip chromium_src-6516805e8c69ac65bcb7d52a2a208be97a7d2a50.tar.gz chromium_src-6516805e8c69ac65bcb7d52a2a208be97a7d2a50.tar.bz2 |
Remove kuint16max.
BUG=138542
Committed: https://crrev.com/0d94fda8c494d7a6c27d065d782f42e99d834f46
Cr-Commit-Position: refs/heads/master@{#362431}
Review URL: https://codereview.chromium.org/1475803002
Cr-Commit-Position: refs/heads/master@{#362472}
Diffstat (limited to 'extensions/common')
-rw-r--r-- | extensions/common/permissions/usb_device_permission_data.cc | 18 | ||||
-rw-r--r-- | extensions/common/permissions/usb_device_permission_data.h | 21 |
2 files changed, 20 insertions, 19 deletions
diff --git a/extensions/common/permissions/usb_device_permission_data.cc b/extensions/common/permissions/usb_device_permission_data.cc index fbd4428..5d49487 100644 --- a/extensions/common/permissions/usb_device_permission_data.cc +++ b/extensions/common/permissions/usb_device_permission_data.cc @@ -4,6 +4,7 @@ #include "extensions/common/permissions/usb_device_permission_data.h" +#include <limits> #include <string> #include <tuple> #include <vector> @@ -30,13 +31,12 @@ UsbDevicePermissionData::UsbDevicePermissionData() : vendor_id_(0), product_id_(0), interface_id_(ANY_INTERFACE) { } -UsbDevicePermissionData::UsbDevicePermissionData(uint16 vendor_id, - uint16 product_id, +UsbDevicePermissionData::UsbDevicePermissionData(uint16_t vendor_id, + uint16_t product_id, int interface_id) - : vendor_id_(vendor_id), - product_id_(product_id), - interface_id_(interface_id) { -} + : vendor_id_(vendor_id), + product_id_(product_id), + interface_id_(interface_id) {} bool UsbDevicePermissionData::Check( const APIPermission::CheckParam* param) const { @@ -69,19 +69,19 @@ bool UsbDevicePermissionData::FromValue(const base::Value* value) { int temp; if (!dict_value->GetInteger(kVendorIdKey, &temp)) return false; - if (temp < 0 || temp > kuint16max) + if (temp < 0 || temp > std::numeric_limits<uint16_t>::max()) return false; vendor_id_ = temp; if (!dict_value->GetInteger(kProductIdKey, &temp)) return false; - if (temp < 0 || temp > kuint16max) + if (temp < 0 || temp > std::numeric_limits<uint16_t>::max()) return false; product_id_ = temp; if (!dict_value->GetInteger(kInterfaceIdKey, &temp)) interface_id_ = ANY_INTERFACE; - else if (temp < ANY_INTERFACE || temp > kuint8max) + else if (temp < ANY_INTERFACE || temp > std::numeric_limits<uint8_t>::max()) return false; else interface_id_ = temp; diff --git a/extensions/common/permissions/usb_device_permission_data.h b/extensions/common/permissions/usb_device_permission_data.h index 001b12c..e72cc6c 100644 --- a/extensions/common/permissions/usb_device_permission_data.h +++ b/extensions/common/permissions/usb_device_permission_data.h @@ -4,9 +4,10 @@ #ifndef EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ #define EXTENSIONS_COMMON_PERMISSIONS_USB_DEVICE_PERMISSION_DATA_H_ +#include <stdint.h> + #include <string> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "extensions/common/permissions/api_permission.h" @@ -20,7 +21,7 @@ namespace extensions { // A pattern that can be used to match a USB device permission. // Should be of the format: vendorId:productId, where both vendorId and -// productId are decimal strings representing uint16 values. +// productId are decimal strings representing uint16_t values. class UsbDevicePermissionData { public: enum SpecialInterfaces { @@ -35,8 +36,8 @@ class UsbDevicePermissionData { }; UsbDevicePermissionData(); - UsbDevicePermissionData(uint16 vendor_id, - uint16 product_id, + UsbDevicePermissionData(uint16_t vendor_id, + uint16_t product_id, int interface_id); // Check if |param| (which must be a UsbDevicePermissionData::CheckParam) @@ -52,17 +53,17 @@ class UsbDevicePermissionData { bool operator<(const UsbDevicePermissionData& rhs) const; bool operator==(const UsbDevicePermissionData& rhs) const; - const uint16& vendor_id() const { return vendor_id_; } - const uint16& product_id() const { return product_id_; } + const uint16_t& vendor_id() const { return vendor_id_; } + const uint16_t& product_id() const { return product_id_; } // These accessors are provided for IPC_STRUCT_TRAITS_MEMBER. Please // think twice before using them for anything else. - uint16& vendor_id() { return vendor_id_; } - uint16& product_id() { return product_id_; } + uint16_t& vendor_id() { return vendor_id_; } + uint16_t& product_id() { return product_id_; } private: - uint16 vendor_id_; - uint16 product_id_; + uint16_t vendor_id_; + uint16_t product_id_; int interface_id_; }; |