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

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

Issue 23475048: Fixes crashing in RequestUsbDevicesAccess (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
Index: chrome/browser/usb/usb_device.cc
diff --git a/chrome/browser/usb/usb_device.cc b/chrome/browser/usb/usb_device.cc
index 39d81a81c5a486c642f085529e4dd274e36851d1..d238cbf9a5a57186779eec8b20e7a89443678783 100644
--- a/chrome/browser/usb/usb_device.cc
+++ b/chrome/browser/usb/usb_device.cc
@@ -20,6 +20,16 @@
using content::BrowserThread;
+namespace {
+
+void OnRequestUsbAccessReplied(
+ const base::Callback<void(bool success)>& callback,
+ bool success) {
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ base::Bind(callback, success));
+}
+
+} // namespace
UsbDevice::UsbDevice(
scoped_refptr<UsbContext> context,
PlatformUsbDevice platform_device,
@@ -55,6 +65,7 @@ UsbDevice::~UsbDevice() {
}
#if defined(OS_CHROMEOS)
+
void UsbDevice::RequestUsbAcess(
int interface_id,
const base::Callback<void(bool success)>& callback) {
@@ -78,19 +89,10 @@ void UsbDevice::RequestUsbAcess(
this->vendor_id_,
this->product_id_,
interface_id,
- base::Bind(&UsbDevice::OnRequestUsbAccessReplied,
- base::Unretained(this),
- callback)));
+ base::Bind(&OnRequestUsbAccessReplied, callback)));
}
}
-void UsbDevice::OnRequestUsbAccessReplied(
- const base::Callback<void(bool success)>& callback,
- bool success) {
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- base::Bind(callback, success));
-}
-
#endif
scoped_refptr<UsbDeviceHandle> UsbDevice::Open() {
« chrome/browser/extensions/api/usb/usb_api.cc ('K') | « chrome/browser/usb/usb_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698