| 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 // Messages for Web Bluetooth API. | 5 // Messages for Web Bluetooth API. |
| 6 // Multiply-included message file, hence no include guard. | 6 // Multiply-included message file, hence no include guard. |
| 7 | 7 |
| 8 // Web Bluetooth Security | 8 // Web Bluetooth Security |
| 9 // The security mechanisms of Bluetooth are described in the specification: | 9 // The security mechanisms of Bluetooth are described in the specification: |
| 10 // https://webbluetoothcg.github.io/web-bluetooth | 10 // https://webbluetoothcg.github.io/web-bluetooth |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Add device to the origin's allowed devices map. with the union of the service | 74 // Add device to the origin's allowed devices map. with the union of the service |
| 75 // UUIDs from filters and options.optionalServices as allowed services. | 75 // UUIDs from filters and options.optionalServices as allowed services. |
| 76 // | 76 // |
| 77 // Get the BluetoothDevice representing device and resolve promise with the | 77 // Get the BluetoothDevice representing device and resolve promise with the |
| 78 // result. | 78 // result. |
| 79 // """ | 79 // """ |
| 80 | 80 |
| 81 #include "ipc/ipc_message_macros.h" | 81 #include "ipc/ipc_message_macros.h" |
| 82 #include "content/common/bluetooth/bluetooth_device.h" | 82 #include "content/common/bluetooth/bluetooth_device.h" |
| 83 #include "content/common/bluetooth/bluetooth_error.h" | 83 #include "content/common/bluetooth/bluetooth_error.h" |
| 84 #include "content/common/bluetooth/bluetooth_scan_filter.h" |
| 84 | 85 |
| 85 #define IPC_MESSAGE_START BluetoothMsgStart | 86 #define IPC_MESSAGE_START BluetoothMsgStart |
| 86 | 87 |
| 87 IPC_ENUM_TRAITS_MAX_VALUE( | 88 IPC_ENUM_TRAITS_MAX_VALUE( |
| 88 device::BluetoothDevice::VendorIDSource, | 89 device::BluetoothDevice::VendorIDSource, |
| 89 device::BluetoothDevice::VendorIDSource::VENDOR_ID_MAX_VALUE) | 90 device::BluetoothDevice::VendorIDSource::VENDOR_ID_MAX_VALUE) |
| 90 | 91 |
| 91 IPC_STRUCT_TRAITS_BEGIN(content::BluetoothDevice) | 92 IPC_STRUCT_TRAITS_BEGIN(content::BluetoothDevice) |
| 92 IPC_STRUCT_TRAITS_MEMBER(instance_id) | 93 IPC_STRUCT_TRAITS_MEMBER(instance_id) |
| 93 IPC_STRUCT_TRAITS_MEMBER(name) | 94 IPC_STRUCT_TRAITS_MEMBER(name) |
| 94 IPC_STRUCT_TRAITS_MEMBER(device_class) | 95 IPC_STRUCT_TRAITS_MEMBER(device_class) |
| 95 IPC_STRUCT_TRAITS_MEMBER(vendor_id_source) | 96 IPC_STRUCT_TRAITS_MEMBER(vendor_id_source) |
| 96 IPC_STRUCT_TRAITS_MEMBER(vendor_id) | 97 IPC_STRUCT_TRAITS_MEMBER(vendor_id) |
| 97 IPC_STRUCT_TRAITS_MEMBER(product_id) | 98 IPC_STRUCT_TRAITS_MEMBER(product_id) |
| 98 IPC_STRUCT_TRAITS_MEMBER(product_version) | 99 IPC_STRUCT_TRAITS_MEMBER(product_version) |
| 99 IPC_STRUCT_TRAITS_MEMBER(paired) | 100 IPC_STRUCT_TRAITS_MEMBER(paired) |
| 100 IPC_STRUCT_TRAITS_MEMBER(uuids) | 101 IPC_STRUCT_TRAITS_MEMBER(uuids) |
| 101 IPC_STRUCT_TRAITS_END() | 102 IPC_STRUCT_TRAITS_END() |
| 102 | 103 |
| 103 IPC_ENUM_TRAITS_MAX_VALUE(content::BluetoothError, | 104 IPC_ENUM_TRAITS_MAX_VALUE(content::BluetoothError, |
| 104 content::BluetoothError::ENUM_MAX_VALUE) | 105 content::BluetoothError::ENUM_MAX_VALUE) |
| 105 | 106 |
| 107 IPC_STRUCT_TRAITS_BEGIN(content::BluetoothScanFilter) |
| 108 IPC_STRUCT_TRAITS_MEMBER(services) |
| 109 IPC_STRUCT_TRAITS_END() |
| 110 |
| 106 // Messages sent from the browser to the renderer. | 111 // Messages sent from the browser to the renderer. |
| 107 | 112 |
| 108 // Informs the renderer that the device request |request_id| succeeded. | 113 // Informs the renderer that the device request |request_id| succeeded. |
| 109 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceSuccess, | 114 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceSuccess, |
| 110 int /* thread_id */, | 115 int /* thread_id */, |
| 111 int /* request_id */, | 116 int /* request_id */, |
| 112 content::BluetoothDevice /* device */) | 117 content::BluetoothDevice /* device */) |
| 113 | 118 |
| 114 // Informs the renderer that the device request |request_id| failed. | 119 // Informs the renderer that the device request |request_id| failed. |
| 115 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceError, | 120 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceError, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 172 |
| 168 // Messages sent from the renderer to the browser. | 173 // Messages sent from the renderer to the browser. |
| 169 | 174 |
| 170 // Requests a bluetooth device from the browser. | 175 // Requests a bluetooth device from the browser. |
| 171 // TODO(scheib): UI to select and permit access to a device crbug.com/436280. | 176 // TODO(scheib): UI to select and permit access to a device crbug.com/436280. |
| 172 // This will include refactoring messages to be associated with an origin | 177 // This will include refactoring messages to be associated with an origin |
| 173 // and making this initial requestDevice call with an associated frame. | 178 // and making this initial requestDevice call with an associated frame. |
| 174 // This work is deferred to simplify initial prototype patches. | 179 // This work is deferred to simplify initial prototype patches. |
| 175 // The Bluetooth feature, and the BluetoothDispatcherHost are behind | 180 // The Bluetooth feature, and the BluetoothDispatcherHost are behind |
| 176 // the --enable-experimental-web-platform-features flag. | 181 // the --enable-experimental-web-platform-features flag. |
| 177 IPC_MESSAGE_CONTROL2(BluetoothHostMsg_RequestDevice, | 182 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_RequestDevice, |
| 178 int /* thread_id */, | 183 int /* thread_id */, |
| 179 int /* request_id */) | 184 int /* request_id */, |
| 185 std::vector<content::BluetoothScanFilter>, |
| 186 std::vector<device::BluetoothUUID> /* optional_services */) |
| 180 | 187 |
| 181 // Connects to a bluetooth device. | 188 // Connects to a bluetooth device. |
| 182 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ConnectGATT, | 189 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ConnectGATT, |
| 183 int /* thread_id */, | 190 int /* thread_id */, |
| 184 int /* request_id */, | 191 int /* request_id */, |
| 185 std::string /* device_instance_id */) | 192 std::string /* device_instance_id */) |
| 186 | 193 |
| 187 // Gets primary service from bluetooth device. | 194 // Gets primary service from bluetooth device. |
| 188 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetPrimaryService, | 195 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetPrimaryService, |
| 189 int /* thread_id */, | 196 int /* thread_id */, |
| 190 int /* request_id */, | 197 int /* request_id */, |
| 191 std::string /* device_instance_id */, | 198 std::string /* device_instance_id */, |
| 192 std::string /* service_uuid */) | 199 std::string /* service_uuid */) |
| 193 | 200 |
| 194 // Gets a GATT Characteristic within a GATT Service. | 201 // Gets a GATT Characteristic within a GATT Service. |
| 195 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetCharacteristic, | 202 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetCharacteristic, |
| 196 int /* thread_id */, | 203 int /* thread_id */, |
| 197 int /* request_id */, | 204 int /* request_id */, |
| 198 std::string /* service_instance_id */, | 205 std::string /* service_instance_id */, |
| 199 std::string /* characteristic_uuid */) | 206 std::string /* characteristic_uuid */) |
| 200 | 207 |
| 201 // Reads the characteristics value from a bluetooth device. | 208 // Reads the characteristics value from a bluetooth device. |
| 202 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ReadValue, | 209 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ReadValue, |
| 203 int /* thread_id */, | 210 int /* thread_id */, |
| 204 int /* request_id */, | 211 int /* request_id */, |
| 205 std::string /* characteristic_instance_id */) | 212 std::string /* characteristic_instance_id */) |
| OLD | NEW |