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

Unified Diff: device/usb/usb_device_impl.cc

Issue 1681383002: Add path open errors from the permission broker to the device log. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_request_access
Patch Set: Addresses stevenjb@'s comments. Created 4 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 | « device/usb/usb_device_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_device_impl.cc
diff --git a/device/usb/usb_device_impl.cc b/device/usb/usb_device_impl.cc
index 271b631b272f44cc52652ac86a4541d70c644847..52806996c31f669c923e500b5f542779c41eea5b 100644
--- a/device/usb/usb_device_impl.cc
+++ b/device/usb/usb_device_impl.cc
@@ -196,7 +196,8 @@ void UsbDeviceImpl::Open(const OpenCallback& callback) {
DCHECK(client) << "Could not get permission broker client.";
client->OpenPath(
device_path_,
- base::Bind(&UsbDeviceImpl::OnOpenRequestComplete, this, callback));
+ base::Bind(&UsbDeviceImpl::OnOpenRequestComplete, this, callback),
+ base::Bind(&UsbDeviceImpl::OnOpenRequestError, this, callback));
#else
blocking_task_runner_->PostTask(
FROM_HERE,
@@ -291,14 +292,18 @@ void UsbDeviceImpl::OnOpenRequestComplete(const OpenCallback& callback,
base::Passed(&fd), callback));
}
+void UsbDeviceImpl::OnOpenRequestError(const OpenCallback& callback,
+ const std::string& error_name,
+ const std::string& error_message) {
+ USB_LOG(EVENT) << "Permission broker failed to open the device: "
+ << error_name << ": " << error_message;
+ callback.Run(nullptr);
+}
+
void UsbDeviceImpl::OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd,
const OpenCallback& callback) {
fd.CheckValidity();
- if (!fd.is_valid()) {
- USB_LOG(EVENT) << "Did not get valid device handle from permission broker.";
- task_runner_->PostTask(FROM_HERE, base::Bind(callback, nullptr));
- return;
- }
+ DCHECK(fd.is_valid());
PlatformUsbDeviceHandle handle;
const int rv = libusb_open_fd(platform_device_, fd.TakeValue(), &handle);
« no previous file with comments | « device/usb/usb_device_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698