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

Unified Diff: Source/modules/webusb/USB.h

Issue 1291753004: Add onconnect and ondisconnect events to navigator.usb. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update LayoutTests. Created 5 years, 4 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/EventTargetModulesFactory.in ('k') | Source/modules/webusb/USB.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webusb/USB.h
diff --git a/Source/modules/webusb/USB.h b/Source/modules/webusb/USB.h
index 7a5cb00d5dd4885fb0535cd063b8dd609fb02be5..5d2d60ca1894b3c65f34f596865955afa2d624f1 100644
--- a/Source/modules/webusb/USB.h
+++ b/Source/modules/webusb/USB.h
@@ -7,6 +7,7 @@
#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/events/EventTarget.h"
#include "modules/webusb/USBController.h"
#include "platform/heap/Handle.h"
@@ -17,9 +18,10 @@ class ScriptState;
class USBDeviceRequestOptions;
class USB final
- : public GarbageCollectedFinalized<USB>
- , public ScriptWrappable {
+ : public RefCountedGarbageCollectedEventTargetWithInlineData<USB> {
DEFINE_WRAPPERTYPEINFO();
+ REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(USB);
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(USB);
public:
static USB* create(LocalFrame& frame)
{
@@ -28,8 +30,15 @@ public:
explicit USB(LocalFrame& frame);
+ // USB.idl
ScriptPromise getDevices(ScriptState*);
ScriptPromise requestDevice(ScriptState*, const USBDeviceRequestOptions&);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(connect);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect);
+
+ // EventTarget overrides.
+ ExecutionContext* executionContext() const override;
+ const AtomicString& interfaceName() const override;
DECLARE_VIRTUAL_TRACE();
« no previous file with comments | « Source/modules/EventTargetModulesFactory.in ('k') | Source/modules/webusb/USB.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698