Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: chrome/browser/usb/usb_chooser_bubble_delegate.cc

Issue 1646783002: Update webusb_descriptors.cc to parse the new WebUSB descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@io_buffer
Patch Set: Sometimes MSVC complains about passing size_type to BarrierClosure. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/devices_app/usb/device_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/usb/usb_chooser_bubble_delegate.cc
diff --git a/chrome/browser/usb/usb_chooser_bubble_delegate.cc b/chrome/browser/usb/usb_chooser_bubble_delegate.cc
index 2243eab2984a1e403ed230247df7135a6486a602..99e7b65690717be99d2c1218f010a72b74da46f6 100644
--- a/chrome/browser/usb/usb_chooser_bubble_delegate.cc
+++ b/chrome/browser/usb/usb_chooser_bubble_delegate.cc
@@ -48,16 +48,16 @@ void RecordChooserClosure(WebUsbChooserClosed disposition) {
WEBUSB_CHOOSER_CLOSED_MAX);
}
-// Check if the origin is in the description set.
-bool FindOriginInDescriptorSet(const device::WebUsbDescriptorSet* set,
- const GURL& origin) {
- if (!set)
+// Check if the origin is allowed.
+bool FindInAllowedOrigins(const device::WebUsbAllowedOrigins* allowed_origins,
+ const GURL& origin) {
+ if (!allowed_origins)
return false;
- if (ContainsValue(set->origins, origin))
+ if (ContainsValue(allowed_origins->origins, origin))
return true;
- for (const auto& config : set->configurations) {
+ for (const auto& config : allowed_origins->configurations) {
if (ContainsValue(config.origins, origin))
return true;
@@ -152,7 +152,7 @@ void UsbChooserBubbleDelegate::Close() {}
void UsbChooserBubbleDelegate::OnDeviceAdded(
scoped_refptr<device::UsbDevice> device) {
if (device::UsbDeviceFilter::MatchesAny(device, filters_) &&
- FindOriginInDescriptorSet(
+ FindInAllowedOrigins(
device->webusb_allowed_origins(),
render_frame_host_->GetLastCommittedURL().GetOrigin())) {
devices_.push_back(std::make_pair(device, device->product_string()));
@@ -180,7 +180,7 @@ void UsbChooserBubbleDelegate::GotUsbDeviceList(
const std::vector<scoped_refptr<device::UsbDevice>>& devices) {
for (const auto& device : devices) {
if (device::UsbDeviceFilter::MatchesAny(device, filters_) &&
- FindOriginInDescriptorSet(
+ FindInAllowedOrigins(
device->webusb_allowed_origins(),
render_frame_host_->GetLastCommittedURL().GetOrigin())) {
devices_.push_back(std::make_pair(device, device->product_string()));
« no previous file with comments | « no previous file | device/devices_app/usb/device_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698