Index: third_party/WebKit/Source/modules/webusb/USB.h |
diff --git a/third_party/WebKit/Source/modules/webusb/USB.h b/third_party/WebKit/Source/modules/webusb/USB.h |
index e79cef9cbdfddfd85cc805f26a373b3c9ff47195..4a47e756bec768a595dccf585c56b5bdfb4c1ae7 100644 |
--- a/third_party/WebKit/Source/modules/webusb/USB.h |
+++ b/third_party/WebKit/Source/modules/webusb/USB.h |
@@ -9,30 +9,29 @@ |
#include "bindings/core/v8/ScriptWrappable.h" |
#include "core/dom/ContextLifecycleObserver.h" |
#include "core/events/EventTarget.h" |
+#include "device/usb/public/interfaces/chooser_service.mojom-wtf.h" |
+#include "device/usb/public/interfaces/device_manager.mojom-wtf.h" |
#include "platform/heap/Handle.h" |
-#include "public/platform/modules/webusb/WebUSBClient.h" |
namespace blink { |
class LocalFrame; |
+class ScopedScriptPromiseResolver; |
class ScriptState; |
class USBDeviceRequestOptions; |
-class WebUSBDevice; |
class USB final |
: public EventTargetWithInlineData |
- , public ContextLifecycleObserver |
- , public WebUSBClient::Observer { |
+ , public ContextLifecycleObserver { |
DEFINE_WRAPPERTYPEINFO(); |
USING_GARBAGE_COLLECTED_MIXIN(USB); |
- USING_PRE_FINALIZER(USB, dispose); |
public: |
static USB* create(LocalFrame& frame) |
{ |
return new USB(frame); |
} |
- ~USB() override; |
+ virtual ~USB(); |
// USB.idl |
ScriptPromise getDevices(ScriptState*); |
@@ -47,17 +46,21 @@ public: |
// ContextLifecycleObserver overrides. |
void contextDestroyed() override; |
- // WebUSBClient::Observer overrides. |
- void onDeviceConnected(std::unique_ptr<WebUSBDevice>) override; |
- void onDeviceDisconnected(std::unique_ptr<WebUSBDevice>) override; |
+ device::usb::wtf::DeviceManager* deviceManager() const { return m_deviceManager.get(); } |
+ |
+ void onGetDevices(ScriptPromiseResolver*, mojo::WTFArray<device::usb::wtf::DeviceInfoPtr>); |
+ void onGetPermission(ScriptPromiseResolver*, device::usb::wtf::DeviceInfoPtr); |
+ void onDeviceChanges(device::usb::wtf::DeviceChangeNotificationPtr); |
DECLARE_VIRTUAL_TRACE(); |
private: |
explicit USB(LocalFrame& frame); |
- void dispose(); |
- WebUSBClient* m_client; |
+ device::usb::wtf::DeviceManagerPtr m_deviceManager; |
+ HeapHashSet<Member<ScriptPromiseResolver>> m_deviceManagerRequests; |
+ device::usb::wtf::ChooserServicePtr m_chooserService; |
+ HeapHashSet<Member<ScriptPromiseResolver>> m_chooserServiceRequests; |
}; |
} // namespace blink |