summaryrefslogtreecommitdiffstats
path: root/extensions/common
diff options
context:
space:
mode:
authoravi <avi@chromium.org>2015-12-01 09:21:01 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-01 17:21:56 +0000
commit911c3c05c6eb35562f354b5b4ddb57528141357f (patch)
treef96a6ac1adc64a75b56eff7ba43c6a269ce81d94 /extensions/common
parent1d9641452a852078f8bee59d24467c10541ffca4 (diff)
downloadchromium_src-911c3c05c6eb35562f354b5b4ddb57528141357f.zip
chromium_src-911c3c05c6eb35562f354b5b4ddb57528141357f.tar.gz
chromium_src-911c3c05c6eb35562f354b5b4ddb57528141357f.tar.bz2
Revert of Remove kuint16max. (patchset #7 id:120001 of https://codereview.chromium.org/1475803002/ )
Reason for revert: missed one :( Original issue's description: > Remove kuint16max. > > BUG=138542 > > Committed: https://crrev.com/0d94fda8c494d7a6c27d065d782f42e99d834f46 > Cr-Commit-Position: refs/heads/master@{#362431} TBR=treib@chromium.org,mark@chromium.org,sergeyu@chromium.org,bartfab@chromium.org,rsleevi@chromium.org,sky@chromium.org,cpu@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=138542 Review URL: https://codereview.chromium.org/1485853003 Cr-Commit-Position: refs/heads/master@{#362444}
Diffstat (limited to 'extensions/common')
-rw-r--r--extensions/common/permissions/usb_device_permission_data.cc18
-rw-r--r--extensions/common/permissions/usb_device_permission_data.h21
2 files changed, 19 insertions, 20 deletions
diff --git a/extensions/common/permissions/usb_device_permission_data.cc b/extensions/common/permissions/usb_device_permission_data.cc
index 5d49487..fbd4428 100644
--- a/extensions/common/permissions/usb_device_permission_data.cc
+++ b/extensions/common/permissions/usb_device_permission_data.cc
@@ -4,7 +4,6 @@
#include "extensions/common/permissions/usb_device_permission_data.h"
-#include <limits>
#include <string>
#include <tuple>
#include <vector>
@@ -31,12 +30,13 @@ UsbDevicePermissionData::UsbDevicePermissionData()
: vendor_id_(0), product_id_(0), interface_id_(ANY_INTERFACE) {
}
-UsbDevicePermissionData::UsbDevicePermissionData(uint16_t vendor_id,
- uint16_t product_id,
+UsbDevicePermissionData::UsbDevicePermissionData(uint16 vendor_id,
+ uint16 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 > std::numeric_limits<uint16_t>::max())
+ if (temp < 0 || temp > kuint16max)
return false;
vendor_id_ = temp;
if (!dict_value->GetInteger(kProductIdKey, &temp))
return false;
- if (temp < 0 || temp > std::numeric_limits<uint16_t>::max())
+ if (temp < 0 || temp > kuint16max)
return false;
product_id_ = temp;
if (!dict_value->GetInteger(kInterfaceIdKey, &temp))
interface_id_ = ANY_INTERFACE;
- else if (temp < ANY_INTERFACE || temp > std::numeric_limits<uint8_t>::max())
+ else if (temp < ANY_INTERFACE || temp > kuint8max)
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 e72cc6c..001b12c 100644
--- a/extensions/common/permissions/usb_device_permission_data.h
+++ b/extensions/common/permissions/usb_device_permission_data.h
@@ -4,10 +4,9 @@
#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"
@@ -21,7 +20,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_t values.
+// productId are decimal strings representing uint16 values.
class UsbDevicePermissionData {
public:
enum SpecialInterfaces {
@@ -36,8 +35,8 @@ class UsbDevicePermissionData {
};
UsbDevicePermissionData();
- UsbDevicePermissionData(uint16_t vendor_id,
- uint16_t product_id,
+ UsbDevicePermissionData(uint16 vendor_id,
+ uint16 product_id,
int interface_id);
// Check if |param| (which must be a UsbDevicePermissionData::CheckParam)
@@ -53,17 +52,17 @@ class UsbDevicePermissionData {
bool operator<(const UsbDevicePermissionData& rhs) const;
bool operator==(const UsbDevicePermissionData& rhs) const;
- const uint16_t& vendor_id() const { return vendor_id_; }
- const uint16_t& product_id() const { return product_id_; }
+ const uint16& vendor_id() const { return vendor_id_; }
+ const uint16& 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_t& vendor_id() { return vendor_id_; }
- uint16_t& product_id() { return product_id_; }
+ uint16& vendor_id() { return vendor_id_; }
+ uint16& product_id() { return product_id_; }
private:
- uint16_t vendor_id_;
- uint16_t product_id_;
+ uint16 vendor_id_;
+ uint16 product_id_;
int interface_id_;
};