Skip to content

Commit

Permalink
fix: select-usb-device should respect filters option (#41166)
Browse files Browse the repository at this point in the history
fix: select-usb-device should respect filters option
  • Loading branch information
codebytere committed Jan 31, 2024
1 parent 6df3443 commit e4d5dc1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shell/browser/usb/usb_chooser_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ void UsbChooserController::GotUsbDeviceList(
auto* rfh = content::RenderFrameHost::FromID(render_frame_host_id_);
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::HandleScope scope(isolate);

// "select-usb-device" should respect |filters|.
devices.erase(std::remove_if(devices.begin(), devices.end(),
[this](const auto& device_info) {
return !DisplayDevice(*device_info);
}),
devices.end());

v8::Local<v8::Object> details = gin::DataObjectBuilder(isolate)
.Set("deviceList", devices)
.Set("frame", rfh)
Expand Down

0 comments on commit e4d5dc1

Please sign in to comment.