| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 6 #define CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/child/worker_task_runner.h" | 10 #include "content/child/worker_task_runner.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 blink::WebBluetoothConnectGATTCallbacks* callbacks); | 55 blink::WebBluetoothConnectGATTCallbacks* callbacks); |
| 56 void getPrimaryService( | 56 void getPrimaryService( |
| 57 const blink::WebString& device_instance_id, | 57 const blink::WebString& device_instance_id, |
| 58 const blink::WebString& service_uuid, | 58 const blink::WebString& service_uuid, |
| 59 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks); | 59 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks); |
| 60 | 60 |
| 61 void getCharacteristic( | 61 void getCharacteristic( |
| 62 const blink::WebString& service_instance_id, | 62 const blink::WebString& service_instance_id, |
| 63 const blink::WebString& characteristic_uuid, | 63 const blink::WebString& characteristic_uuid, |
| 64 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); | 64 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); |
| 65 void readValue(const blink::WebString& characteristic_instance_id, |
| 66 blink::WebBluetoothReadValueCallbacks* callbacks); |
| 65 | 67 |
| 66 // WorkerTaskRunner::Observer implementation. | 68 // WorkerTaskRunner::Observer implementation. |
| 67 void OnWorkerRunLoopStopped() override; | 69 void OnWorkerRunLoopStopped() override; |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 // IPC Handlers, see definitions in bluetooth_messages.h. | 72 // IPC Handlers, see definitions in bluetooth_messages.h. |
| 71 void OnRequestDeviceSuccess(int thread_id, | 73 void OnRequestDeviceSuccess(int thread_id, |
| 72 int request_id, | 74 int request_id, |
| 73 const BluetoothDevice& device); | 75 const BluetoothDevice& device); |
| 74 void OnRequestDeviceError(int thread_id, | 76 void OnRequestDeviceError(int thread_id, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 88 void OnGetPrimaryServiceError(int thread_id, | 90 void OnGetPrimaryServiceError(int thread_id, |
| 89 int request_id, | 91 int request_id, |
| 90 BluetoothError error_type); | 92 BluetoothError error_type); |
| 91 void OnGetCharacteristicSuccess( | 93 void OnGetCharacteristicSuccess( |
| 92 int thread_id, | 94 int thread_id, |
| 93 int request_id, | 95 int request_id, |
| 94 const std::string& characteristic_instance_id); | 96 const std::string& characteristic_instance_id); |
| 95 void OnGetCharacteristicError(int thread_id, | 97 void OnGetCharacteristicError(int thread_id, |
| 96 int request_id, | 98 int request_id, |
| 97 BluetoothError error_type); | 99 BluetoothError error_type); |
| 100 void OnReadValueSuccess(int thread_id, |
| 101 int request_id, |
| 102 const std::vector<uint8_t>& value); |
| 103 void OnReadValueError(int thread_id, |
| 104 int request_id, |
| 105 BluetoothError error_type); |
| 98 | 106 |
| 99 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 107 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 100 | 108 |
| 101 // Tracks device requests sent to browser to match replies with callbacks. | 109 // Tracks device requests sent to browser to match replies with callbacks. |
| 102 // Owns callback objects. | 110 // Owns callback objects. |
| 103 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> | 111 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> |
| 104 pending_requests_; | 112 pending_requests_; |
| 105 // Tracks requests to connect to a device. | 113 // Tracks requests to connect to a device. |
| 106 // Owns callback objects. | 114 // Owns callback objects. |
| 107 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer> | 115 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer> |
| 108 pending_connect_requests_; | 116 pending_connect_requests_; |
| 109 // Tracks requests to get a primary service from a device. | 117 // Tracks requests to get a primary service from a device. |
| 110 // Owns request objects. | 118 // Owns request objects. |
| 111 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer> | 119 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer> |
| 112 pending_primary_service_requests_; | 120 pending_primary_service_requests_; |
| 113 // Tracks requests to get a characteristic from a service. | 121 // Tracks requests to get a characteristic from a service. |
| 114 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> | 122 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> |
| 115 pending_characteristic_requests_; | 123 pending_characteristic_requests_; |
| 124 // Tracks requests to read from a characteristics. |
| 125 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer> |
| 126 pending_read_value_requests_; |
| 116 | 127 |
| 117 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); | 128 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); |
| 118 }; | 129 }; |
| 119 | 130 |
| 120 } // namespace content | 131 } // namespace content |
| 121 | 132 |
| 122 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 133 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| OLD | NEW |