summaryrefslogtreecommitdiffstats
path: root/src/core/web_usb_detector_qt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/web_usb_detector_qt.h')
-rw-r--r--src/core/web_usb_detector_qt.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/web_usb_detector_qt.h b/src/core/web_usb_detector_qt.h
new file mode 100644
index 000000000..b9ab5e4bb
--- /dev/null
+++ b/src/core/web_usb_detector_qt.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef WEB_USB_DETECTOR_QT_H
+#define WEB_USB_DETECTOR_QT_H
+
+#include "mojo/public/cpp/bindings/associated_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
+#include "services/device/public/mojom/usb_manager.mojom.h"
+#include "services/device/public/mojom/usb_manager_client.mojom.h"
+#include "url/gurl.h"
+
+class WebUsbDetectorQt : public device::mojom::UsbDeviceManagerClient
+{
+public:
+ WebUsbDetectorQt();
+ ~WebUsbDetectorQt() override;
+
+ void Initialize();
+
+private:
+ // device::mojom::UsbDeviceManagerClient implementation.
+ void OnDeviceAdded(device::mojom::UsbDeviceInfoPtr device_info) override;
+ void OnDeviceRemoved(device::mojom::UsbDeviceInfoPtr device_info) override;
+
+ // Connection to |device_manager_instance_|.
+ mojo::Remote<device::mojom::UsbDeviceManager> m_deviceManager;
+ mojo::AssociatedReceiver<device::mojom::UsbDeviceManagerClient> m_clientReceiver { this };
+
+ base::WeakPtrFactory<WebUsbDetectorQt> m_weakFactory { this };
+};
+
+#endif // WEB_USB_DETECTOR_QT_H