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

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

Issue 1850023002: Consume Mojo services directly in Blink's WebUSB implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't do assignments in if statements. Created 4 years, 8 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 | « third_party/WebKit/Source/modules/webusb/DEPS ('k') | third_party/WebKit/Source/modules/webusb/USB.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/DEPS ('k') | third_party/WebKit/Source/modules/webusb/USB.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698