From 0ebe983f1cfdd383a4954127f564b83a4fe4992f Mon Sep 17 00:00:00 2001 From: reillyg Date: Fri, 10 Jul 2015 13:59:39 -0700 Subject: Remove fallback when requesting a single USB interface. This reverts commit 2d475d0ed37bf8f19385537ad31e361f1b21624b. The permission broker now supports opening devices that are partially claimed through the OpenPath method and RequestPathAccess will always fail for these devices so the fallback path from RequestPathAccess to OpenPath is always taken. BUG=500057 Review URL: https://codereview.chromium.org/1227313003 Cr-Commit-Position: refs/heads/master@{#338354} --- device/usb/usb_device.cc | 7 ------- device/usb/usb_device.h | 5 ----- device/usb/usb_device_impl.cc | 34 ---------------------------------- device/usb/usb_device_impl.h | 2 -- 4 files changed, 48 deletions(-) (limited to 'device/usb') diff --git a/device/usb/usb_device.cc b/device/usb/usb_device.cc index 5fa7a34..ceab5ea 100644 --- a/device/usb/usb_device.cc +++ b/device/usb/usb_device.cc @@ -30,11 +30,4 @@ void UsbDevice::CheckUsbAccess(const ResultCallback& callback) { callback.Run(true); } -void UsbDevice::OpenInterface(int interface_id, const OpenCallback& callback) { - // On most platforms nothing special is necessary to open a device for access - // to a particular interface. This is needed until crbug.com/496469 is - // resolved. - Open(callback); -} - } // namespace device diff --git a/device/usb/usb_device.h b/device/usb/usb_device.h index 0d84328..53087c8 100644 --- a/device/usb/usb_device.h +++ b/device/usb/usb_device.h @@ -46,11 +46,6 @@ class UsbDevice : public base::RefCountedThreadSafe { // Creates a UsbDeviceHandle for further manipulation. virtual void Open(const OpenCallback& callback) = 0; - // Creates a UsbDeviceHandle for further manipulation. This method is a - // temporary workaround for crbug.com/500057 while the work to finish - // crbug.com/496469 is completed. - virtual void OpenInterface(int interface_id, const OpenCallback& callback); - // Explicitly closes a device handle. This method will be automatically called // by the destructor of a UsbDeviceHandle as well. virtual bool Close(scoped_refptr handle) = 0; diff --git a/device/usb/usb_device_impl.cc b/device/usb/usb_device_impl.cc index 7122522..114e6ac 100644 --- a/device/usb/usb_device_impl.cc +++ b/device/usb/usb_device_impl.cc @@ -145,20 +145,6 @@ void UsbDeviceImpl::Open(const OpenCallback& callback) { #endif // defined(OS_CHROMEOS) } -#if defined(OS_CHROMEOS) - -void UsbDeviceImpl::OpenInterface(int interface_id, - const OpenCallback& callback) { - chromeos::PermissionBrokerClient* client = - chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient(); - DCHECK(client) << "Could not get permission broker client."; - client->RequestPathAccess( - device_path_, interface_id, - base::Bind(&UsbDeviceImpl::OnPathAccessRequestComplete, this, callback)); -} - -#endif // defined(OS_CHROMEOS) - bool UsbDeviceImpl::Close(scoped_refptr handle) { DCHECK(thread_checker_.CalledOnValidThread()); @@ -265,26 +251,6 @@ void UsbDeviceImpl::OnOpenRequestComplete(const OpenCallback& callback, base::Passed(&fd), callback)); } -void UsbDeviceImpl::OnPathAccessRequestComplete(const OpenCallback& callback, - bool success) { - if (success) { - blocking_task_runner_->PostTask( - FROM_HERE, - base::Bind(&UsbDeviceImpl::OpenOnBlockingThread, this, callback)); - } else { - // Once permission_broker changes for crbug.com/496469 land, - // RequestPathAccess will fail for partially claimed devices regardless of - // the interface number requested. Fall back to OpenPath to prevent a - // regression. This code will then be removed. - chromeos::PermissionBrokerClient* client = - chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient(); - DCHECK(client) << "Could not get permission broker client."; - client->OpenPath( - device_path_, - base::Bind(&UsbDeviceImpl::OnOpenRequestComplete, this, callback)); - } -} - void UsbDeviceImpl::OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd, const OpenCallback& callback) { fd.CheckValidity(); diff --git a/device/usb/usb_device_impl.h b/device/usb/usb_device_impl.h index 586b08d..3e9c8d0 100644 --- a/device/usb/usb_device_impl.h +++ b/device/usb/usb_device_impl.h @@ -39,7 +39,6 @@ class UsbDeviceImpl : public UsbDevice { // UsbDevice implementation: #if defined(OS_CHROMEOS) void CheckUsbAccess(const ResultCallback& callback) override; - void OpenInterface(int interface_id, const OpenCallback& callback) override; #endif // OS_CHROMEOS void Open(const OpenCallback& callback) override; bool Close(scoped_refptr handle) override; @@ -85,7 +84,6 @@ class UsbDeviceImpl : public UsbDevice { #if defined(OS_CHROMEOS) void OnOpenRequestComplete(const OpenCallback& callback, dbus::FileDescriptor fd); - void OnPathAccessRequestComplete(const OpenCallback& callback, bool success); void OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd, const OpenCallback& callback); #endif -- cgit v1.1