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

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: Fix nits 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
« no previous file with comments | « chrome/browser/usb/usb_device.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_device.cc
diff --git a/chrome/browser/usb/usb_device.cc b/chrome/browser/usb/usb_device.cc
index 39d81a81c5a486c642f085529e4dd274e36851d1..021284263112d46c847f03152de8d4e37ffd0dfc 100644
--- a/chrome/browser/usb/usb_device.cc
+++ b/chrome/browser/usb/usb_device.cc
@@ -20,6 +20,17 @@
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 +66,7 @@ UsbDevice::~UsbDevice() {
}
#if defined(OS_CHROMEOS)
+
void UsbDevice::RequestUsbAcess(
int interface_id,
const base::Callback<void(bool success)>& callback) {
@@ -78,19 +90,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() {
« no previous file with comments | « chrome/browser/usb/usb_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698