diff options
author | reillyg <reillyg@chromium.org> | 2015-02-05 20:14:50 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-06 04:15:39 +0000 |
commit | dd6141829c1ad86297b0a2e7faea037ff110956b (patch) | |
tree | dfb48bbf99d8f724a22f925dc8632ccb99af6e06 /device/usb/usb_service.cc | |
parent | 913b668663b854e3d88dcf42f5e055a94d824fb1 (diff) | |
download | chromium_src-dd6141829c1ad86297b0a2e7faea037ff110956b.zip chromium_src-dd6141829c1ad86297b0a2e7faea037ff110956b.tar.gz chromium_src-dd6141829c1ad86297b0a2e7faea037ff110956b.tar.bz2 |
Add a UsbService::Observer function for cleanup actions.
This patch adds an additional function to the UsbService::Observer
interface that should be used to perform cleanup operations when a USB
device is disconnected. This is separate from the OnDeviceRemoved
function so that implementations of that function, which may depend on
other subsystems' knowledge of a connected device, can run before any
cleanup actions have taken place.
A browsertest for the chrome.usb.getUserSelectedDevices is included
which demonstrates the need for this 2-phase event handling.
BUG=452298
Review URL: https://codereview.chromium.org/891853002
Cr-Commit-Position: refs/heads/master@{#314973}
Diffstat (limited to 'device/usb/usb_service.cc')
-rw-r--r-- | device/usb/usb_service.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/device/usb/usb_service.cc b/device/usb/usb_service.cc index 70f054d..3faa3e5 100644 --- a/device/usb/usb_service.cc +++ b/device/usb/usb_service.cc @@ -44,6 +44,10 @@ void UsbService::Observer::OnDeviceAdded(scoped_refptr<UsbDevice> device) { void UsbService::Observer::OnDeviceRemoved(scoped_refptr<UsbDevice> device) { } +void UsbService::Observer::OnDeviceRemovedCleanup( + scoped_refptr<UsbDevice> device) { +} + // static UsbService* UsbService::GetInstance( scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { @@ -85,6 +89,7 @@ void UsbService::NotifyDeviceAdded(scoped_refptr<UsbDevice> device) { void UsbService::NotifyDeviceRemoved(scoped_refptr<UsbDevice> device) { DCHECK(CalledOnValidThread()); FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(device)); + FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemovedCleanup(device)); } } // namespace device |