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

Unified Diff: third_party/WebKit/Source/modules/webusb/USBDevice.h

Issue 1781533002: Track USBDevice open state in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 9 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
Index: third_party/WebKit/Source/modules/webusb/USBDevice.h
diff --git a/third_party/WebKit/Source/modules/webusb/USBDevice.h b/third_party/WebKit/Source/modules/webusb/USBDevice.h
index a561e08b78070a9680369fc999b090a05e08d68e..aa6d419dc9ac9d3efa7f6ac6fe5499b3d5463b30 100644
--- a/third_party/WebKit/Source/modules/webusb/USBDevice.h
+++ b/third_party/WebKit/Source/modules/webusb/USBDevice.h
@@ -30,26 +30,27 @@ class USBDevice
public:
using WebType = OwnPtr<WebUSBDevice>;
- static USBDevice* create(PassOwnPtr<WebUSBDevice> device)
+ static USBDevice* create(PassOwnPtr<WebUSBDevice> device, ExecutionContext* context)
{
- return new USBDevice(device);
+ return new USBDevice(device, context);
}
- static USBDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebUSBDevice> device)
- {
- return create(device);
- }
+ static USBDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebUSBDevice>);
- explicit USBDevice(PassOwnPtr<WebUSBDevice> device)
- : ContextLifecycleObserver(nullptr)
+ explicit USBDevice(PassOwnPtr<WebUSBDevice> device, ExecutionContext* context)
+ : ContextLifecycleObserver(context)
, m_device(device)
+ , m_opened(false)
+ , m_deviceStateChangeInProgress(false)
{
}
virtual ~USBDevice() { }
const WebUSBDeviceInfo& info() const { return m_device->info(); }
+ void onDeviceOpenedOrClosed(bool);
+ // IDL exposed interface:
String guid() const { return info().guid; }
uint8_t usbVersionMajor() { return info().usbVersionMajor; }
uint8_t usbVersionMinor() { return info().usbVersionMinor; }
@@ -66,6 +67,7 @@ public:
String productName() const { return info().productName; }
String serialNumber() const { return info().serialNumber; }
HeapVector<Member<USBConfiguration>> configurations() const;
+ bool opened() const { return m_opened; }
ScriptPromise open(ScriptState*);
ScriptPromise close(ScriptState*);
@@ -90,6 +92,8 @@ public:
private:
OwnPtr<WebUSBDevice> m_device;
+ bool m_opened;
+ bool m_deviceStateChangeInProgress;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USB.cpp ('k') | third_party/WebKit/Source/modules/webusb/USBDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698