| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
|
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
|
| index 1db9949905205f79d758e9f49ce6121aa12bdf6f..7cae3bac3bb129700e60175df237d89bc06276f5 100644
|
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
|
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
|
| @@ -10,22 +10,19 @@
|
| #include "modules/EventTargetModules.h"
|
| #include "modules/bluetooth/BluetoothRemoteGATTServer.h"
|
| #include "platform/heap/Heap.h"
|
| -#include "public/platform/modules/bluetooth/WebBluetoothDevice.h"
|
| -#include "public/platform/modules/bluetooth/WebBluetoothDeviceInit.h"
|
| +#include "public/platform/modules/bluetooth/web_bluetooth.mojom-blink.h"
|
| #include "wtf/text/WTFString.h"
|
| #include <memory>
|
|
|
| namespace blink {
|
|
|
| +class Bluetooth;
|
| class BluetoothAttributeInstanceMap;
|
| class BluetoothRemoteGATTCharacteristic;
|
| class BluetoothRemoteGATTServer;
|
| class BluetoothRemoteGATTService;
|
| class ScriptPromiseResolver;
|
|
|
| -struct WebBluetoothRemoteGATTCharacteristicInit;
|
| -struct WebBluetoothRemoteGATTService;
|
| -
|
| // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL.
|
| //
|
| // Callbacks providing WebBluetoothDevice objects are handled by
|
| @@ -33,28 +30,40 @@ struct WebBluetoothRemoteGATTService;
|
| // "Interface required by CallbackPromiseAdapter" section and the
|
| // CallbackPromiseAdapter class comments.
|
| class BluetoothDevice final : public EventTargetWithInlineData,
|
| - public ContextLifecycleObserver,
|
| - public WebBluetoothDevice {
|
| + public ContextLifecycleObserver {
|
| USING_PRE_FINALIZER(BluetoothDevice, dispose);
|
| DEFINE_WRAPPERTYPEINFO();
|
| USING_GARBAGE_COLLECTED_MIXIN(BluetoothDevice);
|
|
|
| public:
|
| - BluetoothDevice(ExecutionContext*, std::unique_ptr<WebBluetoothDeviceInit>);
|
| + BluetoothDevice(ExecutionContext*,
|
| + const String& id,
|
| + const String& name,
|
| + Bluetooth*);
|
|
|
| // Interface required by CallbackPromiseAdapter:
|
| - using WebType = std::unique_ptr<WebBluetoothDeviceInit>;
|
| static BluetoothDevice* take(ScriptPromiseResolver*,
|
| - std::unique_ptr<WebBluetoothDeviceInit>);
|
| + const String& id,
|
| + const String& name,
|
| + Bluetooth*);
|
| +
|
| + static mojom::blink::WebBluetoothDeviceIdPtr createMojoDeviceId(
|
| + const String& deviceId);
|
|
|
| BluetoothRemoteGATTService* getOrCreateBluetoothRemoteGATTService(
|
| - std::unique_ptr<WebBluetoothRemoteGATTService>);
|
| + const String& serviceInstanceId,
|
| + const String& uuid,
|
| + bool isPrimary,
|
| + const String& deviceInstanceId);
|
| bool isValidService(const String& serviceInstanceId);
|
|
|
| BluetoothRemoteGATTCharacteristic*
|
| getOrCreateBluetoothRemoteGATTCharacteristic(
|
| ExecutionContext*,
|
| - std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>,
|
| + const String& characteristicInstanceId,
|
| + const String& serviceInstanceId,
|
| + const String& uuid,
|
| + uint32_t characteristicProperties,
|
| BluetoothRemoteGATTService*);
|
| bool isValidCharacteristic(const String& characteristicInstanceId);
|
|
|
| @@ -88,15 +97,16 @@ class BluetoothDevice final : public EventTargetWithInlineData,
|
| const AtomicString& interfaceName() const override;
|
| ExecutionContext* getExecutionContext() const override;
|
|
|
| - // WebBluetoothDevice interface:
|
| - void dispatchGattServerDisconnected() override;
|
| + void dispatchGattServerDisconnected();
|
| +
|
| + Bluetooth* bluetooth() { return m_bluetooth; }
|
|
|
| // Interface required by Garbage Collection:
|
| DECLARE_VIRTUAL_TRACE();
|
|
|
| // IDL exposed interface:
|
| - String id() { return m_webDevice->id; }
|
| - String name() { return m_webDevice->name; }
|
| + String id() { return m_id; }
|
| + String name() { return m_name; }
|
| BluetoothRemoteGATTServer* gatt() { return m_gatt; }
|
|
|
| DEFINE_ATTRIBUTE_EVENT_LISTENER(gattserverdisconnected);
|
| @@ -105,8 +115,10 @@ class BluetoothDevice final : public EventTargetWithInlineData,
|
| // Holds all GATT Attributes associated with this BluetoothDevice.
|
| Member<BluetoothAttributeInstanceMap> m_attributeInstanceMap;
|
|
|
| - std::unique_ptr<WebBluetoothDeviceInit> m_webDevice;
|
| + const String m_id;
|
| + const String m_name;
|
| Member<BluetoothRemoteGATTServer> m_gatt;
|
| + Member<Bluetooth> m_bluetooth;
|
| };
|
|
|
| } // namespace blink
|
|
|