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

Unified Diff: public/platform/modules/webusb/WebUSBClient.h

Issue 1340523004: Implement USB connection events through the WebUSB client interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change Member back to PersistentWillBeMember. Created 5 years, 3 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 | « Source/modules/webusb/USBConnectionEvent.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/modules/webusb/WebUSBClient.h
diff --git a/public/platform/modules/webusb/WebUSBClient.h b/public/platform/modules/webusb/WebUSBClient.h
index 5bcff9103fc41de27b5408bddc8bfc4f47e35888..08abdb257f7a925df2a783b2a53d545a30be6fbd 100644
--- a/public/platform/modules/webusb/WebUSBClient.h
+++ b/public/platform/modules/webusb/WebUSBClient.h
@@ -19,6 +19,17 @@ using WebUSBClientRequestDeviceCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBDevi
class WebUSBClient {
public:
+ class Observer {
+ public:
+ virtual ~Observer() { }
+
+ // Called when a device is connected to the system.
+ virtual void onDeviceConnected(WebPassOwnPtr<WebUSBDevice>) = 0;
+
+ // Called when a device is disconnected from the system.
+ virtual void onDeviceDisconnected(WebPassOwnPtr<WebUSBDevice>) = 0;
+ };
+
virtual ~WebUSBClient() { }
// Enumerates available devices.
@@ -28,6 +39,9 @@ public:
// Requests access to a device.
// Ownership of the WebUSBClientRequestDeviceCallbacks is transferred to the client.
virtual void requestDevice(const WebUSBDeviceRequestOptions&, WebUSBClientRequestDeviceCallbacks*) = 0;
+
+ // Sets the observer of device changes through the WebUSBClient.
+ virtual void setObserver(Observer*) { }
};
} // namespace blink
« no previous file with comments | « Source/modules/webusb/USBConnectionEvent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698