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

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

Issue 1946063002: Replace DeviceManager::GetDeviceChanges with a client interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proper_stubs
Patch Set: Rebase.d Created 4 years, 7 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/USB.h
diff --git a/third_party/WebKit/Source/modules/webusb/USB.h b/third_party/WebKit/Source/modules/webusb/USB.h
index e2f05d3c61df315d9b52a9a14903dd20be72a2e4..b6ba9894b4f6451b557d58d40ecbc10725a4d1db 100644
--- a/third_party/WebKit/Source/modules/webusb/USB.h
+++ b/third_party/WebKit/Source/modules/webusb/USB.h
@@ -11,6 +11,7 @@
#include "core/events/EventTarget.h"
#include "device/usb/public/interfaces/chooser_service.mojom-blink.h"
#include "device/usb/public/interfaces/device_manager.mojom-blink.h"
+#include "mojo/public/cpp/bindings/binding.h"
#include "platform/heap/Handle.h"
namespace blink {
@@ -22,9 +23,11 @@ class USBDeviceRequestOptions;
class USB final
: public EventTargetWithInlineData
- , public ContextLifecycleObserver {
+ , public ContextLifecycleObserver
+ , public device::usb::blink::DeviceManagerClient {
DEFINE_WRAPPERTYPEINFO();
USING_GARBAGE_COLLECTED_MIXIN(USB);
+ USING_PRE_FINALIZER(USB, dispose);
public:
static USB* create(LocalFrame& frame)
{
@@ -33,6 +36,8 @@ public:
virtual ~USB();
+ void dispose();
+
// USB.idl
ScriptPromise getDevices(ScriptState*);
ScriptPromise requestDevice(ScriptState*, const USBDeviceRequestOptions&);
@@ -46,11 +51,14 @@ public:
// ContextLifecycleObserver overrides.
void contextDestroyed() override;
+ // DeviceManagerClient implementation.
+ void OnDeviceAdded(device::usb::blink::DeviceInfoPtr);
+ void OnDeviceRemoved(device::usb::blink::DeviceInfoPtr);
+
device::usb::blink::DeviceManager* deviceManager() const { return m_deviceManager.get(); }
void onGetDevices(ScriptPromiseResolver*, mojo::WTFArray<device::usb::blink::DeviceInfoPtr>);
void onGetPermission(ScriptPromiseResolver*, device::usb::blink::DeviceInfoPtr);
- void onDeviceChanges(device::usb::blink::DeviceChangeNotificationPtr);
void onDeviceManagerConnectionError();
void onChooserServiceConnectionError();
@@ -64,6 +72,7 @@ private:
HeapHashSet<Member<ScriptPromiseResolver>> m_deviceManagerRequests;
device::usb::blink::ChooserServicePtr m_chooserService;
HeapHashSet<Member<ScriptPromiseResolver>> m_chooserServiceRequests;
+ mojo::Binding<device::usb::blink::DeviceManagerClient> m_clientBinding;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html ('k') | third_party/WebKit/Source/modules/webusb/USB.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698