OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef USB_h | 5 #ifndef USB_h |
6 #define USB_h | 6 #define USB_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
11 #include "modules/webusb/USBController.h" | 11 #include "modules/webusb/USBController.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class LocalFrame; | 16 class LocalFrame; |
17 class ScriptState; | 17 class ScriptState; |
18 class USBDeviceRequestOptions; | 18 class USBDeviceRequestOptions; |
19 | 19 |
20 class USB final | 20 class USB final |
21 : public RefCountedGarbageCollectedEventTargetWithInlineData<USB> { | 21 : public RefCountedGarbageCollectedEventTargetWithInlineData<USB> { |
22 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
23 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(USB); | 23 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(USB); |
24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(USB); | |
25 public: | 24 public: |
26 static USB* create(LocalFrame& frame) | 25 static USB* create(LocalFrame& frame) |
27 { | 26 { |
28 return new USB(frame); | 27 return new USB(frame); |
29 } | 28 } |
30 | 29 |
31 explicit USB(LocalFrame& frame); | |
32 | |
33 // USB.idl | 30 // USB.idl |
34 ScriptPromise getDevices(ScriptState*); | 31 ScriptPromise getDevices(ScriptState*); |
35 ScriptPromise requestDevice(ScriptState*, const USBDeviceRequestOptions&); | 32 ScriptPromise requestDevice(ScriptState*, const USBDeviceRequestOptions&); |
36 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 33 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
37 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); | 34 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); |
38 | 35 |
39 // EventTarget overrides. | 36 // EventTarget overrides. |
40 ExecutionContext* executionContext() const override; | 37 ExecutionContext* executionContext() const override; |
41 const AtomicString& interfaceName() const override; | 38 const AtomicString& interfaceName() const override; |
42 | 39 |
43 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
44 | 41 |
45 private: | 42 private: |
| 43 explicit USB(LocalFrame& frame); |
| 44 |
46 RawPtrWillBeMember<USBController> m_controller; | 45 RawPtrWillBeMember<USBController> m_controller; |
47 }; | 46 }; |
48 | 47 |
49 } // namespace blink | 48 } // namespace blink |
50 | 49 |
51 #endif // USB_h | 50 #endif // USB_h |
OLD | NEW |