Index: chrome/browser/usb/usb_service.cc |
diff --git a/chrome/browser/usb/usb_service.cc b/chrome/browser/usb/usb_service.cc |
index 21e2e33dbdf202b66050b8d04480316aaf2117a4..fcad23d94fc78ee555ac23a2cacbb330f056096c 100644 |
--- a/chrome/browser/usb/usb_service.cc |
+++ b/chrome/browser/usb/usb_service.cc |
@@ -70,30 +70,38 @@ void UsbService::Cleanup() { |
void UsbService::FindDevices(const uint16 vendor_id, |
const uint16 product_id, |
- vector<scoped_refptr<UsbDevice> >* devices) { |
+ vector<scoped_refptr<UsbDevice> >* devices, |
+ const base::Callback<void()>& callback) { |
DCHECK(event_handler_) << "FindDevices called after event handler stopped."; |
#if defined(OS_CHROMEOS) |
chromeos::PermissionBrokerClient* client = |
chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient(); |
DCHECK(client) << "Could not get permission broker client."; |
- if (!client) |
+ if (!client) { |
+ callback.Run(); |
return; |
+ } |
+ |
client->RequestUsbAccess(vendor_id, |
product_id, |
base::Bind(&UsbService::FindDevicesImpl, |
base::Unretained(this), |
vendor_id, |
product_id, |
- devices)); |
+ devices, |
+ callback)); |
#else |
- FindDevicesImpl(vendor_id, product_id, devices, true); |
+ FindDevicesImpl(vendor_id, product_id, devices, callback, true); |
#endif // defined(OS_CHROMEOS) |
} |
void UsbService::FindDevicesImpl(const uint16 vendor_id, |
const uint16 product_id, |
vector<scoped_refptr<UsbDevice> >* devices, |
+ const base::Callback<void()>& callback, |
bool success) { |
+ base::ScopedClosureRunner run_callback(callback); |
+ |
devices->clear(); |
// If the permission broker was unable to obtain permission for the specified |