diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-05 07:52:17 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-05 07:52:17 +0000 |
commit | 8e4e567b488d22ec0aad82905df86b17845a0dc9 (patch) | |
tree | 3903a9be65ca1573d700abe28ce450b7a398fa3d /chrome/browser/extensions/api/usb | |
parent | d7e3d542b673902ad014c4f6093be319db735534 (diff) | |
download | chromium_src-8e4e567b488d22ec0aad82905df86b17845a0dc9.zip chromium_src-8e4e567b488d22ec0aad82905df86b17845a0dc9.tar.gz chromium_src-8e4e567b488d22ec0aad82905df86b17845a0dc9.tar.bz2 |
Added ability to define explicit interface access permission to chrome.usb.* API.
This piece of information is needed in order to get ChromeOS permission broker grant access to devices that have some interfaces unclaimed by the kernel - see https://gerrit.chromium.org/gerrit/#/c/57136 for details.
BUG=243798
TEST=existing USB unit and browser tests
Review URL: https://chromiumcodereview.appspot.com/16125016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/usb')
-rw-r--r-- | chrome/browser/extensions/api/usb/usb_api.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chrome/browser/extensions/api/usb/usb_api.cc b/chrome/browser/extensions/api/usb/usb_api.cc index 453f8940..948dece 100644 --- a/chrome/browser/extensions/api/usb/usb_api.cc +++ b/chrome/browser/extensions/api/usb/usb_api.cc @@ -428,7 +428,10 @@ void UsbFindDevicesFunction::AsyncWorkStart() { const uint16_t vendor_id = parameters_->options.vendor_id; const uint16_t product_id = parameters_->options.product_id; - UsbDevicePermission::CheckParam param(vendor_id, product_id); + int interface_id = parameters_->options.interface_id.get() ? + *parameters_->options.interface_id.get() : + UsbDevicePermissionData::ANY_INTERFACE; + UsbDevicePermission::CheckParam param(vendor_id, product_id, interface_id); if (!PermissionsData::CheckAPIPermissionWithParam( GetExtension(), APIPermission::kUsbDevice, ¶m)) { LOG(WARNING) << "Insufficient permissions to access device."; @@ -444,8 +447,8 @@ void UsbFindDevicesFunction::AsyncWorkStart() { return; } - service->FindDevices(vendor_id, product_id, &devices_, base::Bind( - &UsbFindDevicesFunction::OnCompleted, this)); + service->FindDevices(vendor_id, product_id, interface_id, &devices_, + base::Bind(&UsbFindDevicesFunction::OnCompleted, this)); } void UsbFindDevicesFunction::OnCompleted() { |