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

Unified Diff: extensions/browser/api/usb/usb_api.cc

Issue 1098823003: Separate USB device permissions prompt logic into subclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jyasskin@'s comments. Created 5 years, 8 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 | « extensions/browser/api/usb/usb_api.h ('k') | extensions/extensions_strings.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/usb/usb_api.cc
diff --git a/extensions/browser/api/usb/usb_api.cc b/extensions/browser/api/usb/usb_api.cc
index d0238130ee55710cfa1bc28c1da1301fca064a6a..0e33ca51581980c7461a6b99a8128a2e3faf70c7 100644
--- a/extensions/browser/api/usb/usb_api.cc
+++ b/extensions/browser/api/usb/usb_api.cc
@@ -641,13 +641,13 @@ ExtensionFunction::ResponseAction UsbGetUserSelectedDevicesFunction::Run() {
return RespondNow(Error(kErrorNotSupported));
}
- AddRef();
prompt_->AskForUsbDevices(
- this, extension(), browser_context(), multiple, filters);
+ extension(), browser_context(), multiple, filters,
+ base::Bind(&UsbGetUserSelectedDevicesFunction::OnDevicesChosen, this));
return RespondLater();
}
-void UsbGetUserSelectedDevicesFunction::OnUsbDevicesChosen(
+void UsbGetUserSelectedDevicesFunction::OnDevicesChosen(
const std::vector<scoped_refptr<UsbDevice>>& devices) {
scoped_ptr<base::ListValue> result(new base::ListValue());
for (const auto& device : devices) {
@@ -655,7 +655,6 @@ void UsbGetUserSelectedDevicesFunction::OnUsbDevicesChosen(
}
Respond(OneArgument(result.release()));
- Release();
}
UsbRequestAccessFunction::UsbRequestAccessFunction() {
« no previous file with comments | « extensions/browser/api/usb/usb_api.h ('k') | extensions/extensions_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698