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

Unified Diff: extensions/browser/api/usb_private/usb_private_api.cc

Issue 601073002: Move string descriptor getters from UsbDeviceHandle to UsbDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix function order. Created 6 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 | « extensions/browser/api/usb/usb_apitest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/usb_private/usb_private_api.cc
diff --git a/extensions/browser/api/usb_private/usb_private_api.cc b/extensions/browser/api/usb_private/usb_private_api.cc
index dd29fd23724064deb8cfccc973c0c04d91dc878a..74abda14d04532702d7057017c6090b7645a120b 100644
--- a/extensions/browser/api/usb_private/usb_private_api.cc
+++ b/extensions/browser/api/usb_private/usb_private_api.cc
@@ -33,7 +33,6 @@ namespace {
const char kErrorInitService[] = "Failed to initialize USB service.";
const char kErrorNoDevice[] = "No such device.";
-const char kErrorOpen[] = "Failed to open device.";
} // namespace
@@ -120,23 +119,17 @@ void UsbPrivateGetDeviceInfoFunction::AsyncWorkStart() {
device_info.product_name.reset(new std::string(name));
}
- scoped_refptr<UsbDeviceHandle> device_handle = device->Open();
- if (!device_handle.get()) {
- CompleteWithError(kErrorOpen);
- return;
- }
-
base::string16 utf16;
- if (device_handle->GetManufacturer(&utf16)) {
+ if (device->GetManufacturer(&utf16)) {
device_info.manufacturer_string.reset(
new std::string(base::UTF16ToUTF8(utf16)));
}
- if (device_handle->GetProduct(&utf16)) {
+ if (device->GetProduct(&utf16)) {
device_info.product_string.reset(new std::string(base::UTF16ToUTF8(utf16)));
}
- if (device_handle->GetSerial(&utf16)) {
+ if (device->GetSerialNumber(&utf16)) {
device_info.serial_string.reset(new std::string(base::UTF16ToUTF8(utf16)));
}
« no previous file with comments | « extensions/browser/api/usb/usb_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698