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

Unified Diff: device/usb/usb_device_linux.cc

Issue 2291983002: chromeos: Remove dbus::FileDescriptor from PermissionBrokerClient (Closed)
Patch Set: Address comments Created 4 years, 4 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_linux.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_linux.cc
diff --git a/device/usb/usb_device_linux.cc b/device/usb/usb_device_linux.cc
index 3bc0bf98b7cd11fa328f9310b1ccef1399499a4e..8b76ea8a708b647bd39d9238f4563b62a56eb3f3 100644
--- a/device/usb/usb_device_linux.cc
+++ b/device/usb/usb_device_linux.cc
@@ -23,7 +23,6 @@
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/permission_broker_client.h"
-#include "dbus/file_descriptor.h" // nogncheck
#endif // defined(OS_CHROMEOS)
namespace device {
@@ -88,10 +87,13 @@ void UsbDeviceLinux::Open(const OpenCallback& callback) {
#if defined(OS_CHROMEOS)
void UsbDeviceLinux::OnOpenRequestComplete(const OpenCallback& callback,
- dbus::FileDescriptor fd) {
- blocking_task_runner_->PostTask(
- FROM_HERE, base::Bind(&UsbDeviceLinux::OpenOnBlockingThreadWithFd, this,
- base::Passed(&fd), callback));
+ base::ScopedFD fd) {
+ if (!fd.is_valid()) {
+ USB_LOG(EVENT) << "Did not get valid device handle from permission broker.";
+ callback.Run(nullptr);
+ return;
+ }
+ Opened(std::move(fd), callback);
}
void UsbDeviceLinux::OnOpenRequestError(const OpenCallback& callback,
@@ -102,20 +104,6 @@ void UsbDeviceLinux::OnOpenRequestError(const OpenCallback& callback,
callback.Run(nullptr);
}
-void UsbDeviceLinux::OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd,
- const OpenCallback& callback) {
- fd.CheckValidity();
- if (fd.is_valid()) {
- base::ScopedFD scoped_fd(fd.TakeValue());
- task_runner_->PostTask(FROM_HERE,
- base::Bind(&UsbDeviceLinux::Opened, this,
- base::Passed(&scoped_fd), callback));
- } else {
- USB_LOG(EVENT) << "Did not get valid device handle from permission broker.";
- task_runner_->PostTask(FROM_HERE, base::Bind(callback, nullptr));
- }
-}
-
#else
void UsbDeviceLinux::OpenOnBlockingThread(const OpenCallback& callback) {
« no previous file with comments | « device/usb/usb_device_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698