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

Unified Diff: device/usb/usb_device.cc

Issue 1695643002: Destroy DeviceImpl when the underlying UsbDevice is disconnected. (Closed) Base URL: reillyg-linux.mtv.corp.google.com:/src/chromium/src@mojo_device_autoclose
Patch Set: Revert change to web_usb_device_impl.cc. 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.h ('k') | device/usb/usb_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_device.cc
diff --git a/device/usb/usb_device.cc b/device/usb/usb_device.cc
index d7ab38bde3d65429eedb2e0a7a259fc8622d7c24..d34e3e0d0f4f21edcfe29c9e0b5befc9fb924abd 100644
--- a/device/usb/usb_device.cc
+++ b/device/usb/usb_device.cc
@@ -9,6 +9,10 @@
namespace device {
+UsbDevice::Observer::~Observer() {}
+
+void UsbDevice::Observer::OnDeviceRemoved(scoped_refptr<UsbDevice> device) {}
+
UsbDevice::UsbDevice(uint16_t vendor_id,
uint16_t product_id,
const base::string16& manufacturer_string,
@@ -30,4 +34,16 @@ void UsbDevice::CheckUsbAccess(const ResultCallback& callback) {
callback.Run(true);
}
+void UsbDevice::AddObserver(Observer* observer) {
+ observer_list_.AddObserver(observer);
+}
+
+void UsbDevice::RemoveObserver(Observer* observer) {
+ observer_list_.RemoveObserver(observer);
+}
+
+void UsbDevice::NotifyDeviceRemoved() {
+ FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(this));
+}
+
} // namespace device
« no previous file with comments | « device/usb/usb_device.h ('k') | device/usb/usb_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698