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

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

Issue 12226137: Fix missing callback chaining in UsbService. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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 | « chrome/browser/usb/usb_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/usb/usb_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698