| Index: content/renderer/bluetooth/bluetooth_dispatcher.h
|
| diff --git a/content/renderer/bluetooth/bluetooth_dispatcher.h b/content/renderer/bluetooth/bluetooth_dispatcher.h
|
| index 4109414400c2bd31b62e9309db61f11cbd7e9227..868456cccb420b649dd24034cf15983ed9e26708 100644
|
| --- a/content/renderer/bluetooth/bluetooth_dispatcher.h
|
| +++ b/content/renderer/bluetooth/bluetooth_dispatcher.h
|
| @@ -17,12 +17,17 @@ class MessageLoop;
|
| class TaskRunner;
|
| }
|
|
|
| +namespace blink {
|
| +class WebBluetoothGATTCharacteristicDelegate;
|
| +}
|
| +
|
| namespace IPC {
|
| class Message;
|
| }
|
|
|
| struct BluetoothCharacteristicRequest;
|
| struct BluetoothPrimaryServiceRequest;
|
| +struct BluetoothNotificationsRequest;
|
|
|
| namespace content {
|
| class ThreadSafeSender;
|
| @@ -69,11 +74,34 @@ class BluetoothDispatcher : public WorkerThread::Observer {
|
| void writeValue(const blink::WebString& characteristic_instance_id,
|
| const std::vector<uint8_t>& value,
|
| blink::WebBluetoothWriteValueCallbacks*);
|
| + void startNotifications(
|
| + const blink::WebString& characteristic_instance_id,
|
| + blink::WebBluetoothGATTCharacteristicDelegate* delegate,
|
| + blink::WebBluetoothNotificationsCallbacks*);
|
| + void stopNotifications(
|
| + const blink::WebString& characteristic_instance_id,
|
| + blink::WebBluetoothGATTCharacteristicDelegate* delegate,
|
| + blink::WebBluetoothNotificationsCallbacks*);
|
| + void characteristicDelegateRemoved(
|
| + const blink::WebString& characteristic_instance_id,
|
| + blink::WebBluetoothGATTCharacteristicDelegate* delegate);
|
|
|
| // WorkerThread::Observer implementation.
|
| void WillStopCurrentWorkerThread() override;
|
|
|
| private:
|
| + bool HasActiveCharacteristicNotification(
|
| + const blink::WebString& characteristic_instance_id);
|
| + void AddToActiveNotificationsMap(
|
| + const blink::WebString& characteristic_instance_id,
|
| + blink::WebBluetoothGATTCharacteristicDelegate* delegate);
|
| + bool WillBeActiveNotificationWhenRemoved(
|
| + const blink::WebString& characteristic_instance_id,
|
| + blink::WebBluetoothGATTCharacteristicDelegate* delegate);
|
| + void RemoveFromActiveNotificationsMap(
|
| + const blink::WebString& characteristic_instance_id,
|
| + blink::WebBluetoothGATTCharacteristicDelegate* delegate);
|
| +
|
| // IPC Handlers, see definitions in bluetooth_messages.h.
|
| void OnRequestDeviceSuccess(int thread_id,
|
| int request_id,
|
| @@ -112,9 +140,21 @@ class BluetoothDispatcher : public WorkerThread::Observer {
|
| void OnWriteValueError(int thread_id,
|
| int request_id,
|
| blink::WebBluetoothError error);
|
| + void OnStartNotificationsSuccess(int thread_id, int request_id);
|
| + void OnStartNotificationsError(int thread_id,
|
| + int request_id,
|
| + blink::WebBluetoothError error);
|
| + void OnStopNotificationsSuccess(int thread_id, int request_id);
|
|
|
| scoped_refptr<ThreadSafeSender> thread_safe_sender_;
|
|
|
| + // Map of characteristic instance ids to characteristic delegates.
|
| + // Keeps track of which characteristic objects are subscribed
|
| + // to notifications.
|
| + std::map<std::string,
|
| + std::set<blink::WebBluetoothGATTCharacteristicDelegate*>>
|
| + active_characteristic_notifications;
|
| +
|
| // Tracks device requests sent to browser to match replies with callbacks.
|
| // Owns callback objects.
|
| IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer>
|
| @@ -135,6 +175,12 @@ class BluetoothDispatcher : public WorkerThread::Observer {
|
| pending_read_value_requests_;
|
| IDMap<blink::WebBluetoothWriteValueCallbacks, IDMapOwnPointer>
|
| pending_write_value_requests_;
|
| + // Tracks requests to start notifications from a characteristic.
|
| + IDMap<BluetoothNotificationsRequest, IDMapOwnPointer>
|
| + pending_start_notifications_requests_;
|
| + // Tracks requests to stop notifications from a characteristic.
|
| + IDMap<BluetoothNotificationsRequest, IDMapOwnPointer>
|
| + pending_stop_notifications_requests_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher);
|
| };
|
|
|