| 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_CONTROL4(BluetoothMsg_RequestDeviceError, | 120 IPC_MESSAGE_CONTROL4(BluetoothMsg_RequestDeviceError, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 177 |
| 173 // Messages sent from the renderer to the browser. | 178 // Messages sent from the renderer to the browser. |
| 174 | 179 |
| 175 // Requests a bluetooth device from the browser. | 180 // Requests a bluetooth device from the browser. |
| 176 // TODO(scheib): UI to select and permit access to a device crbug.com/436280. | 181 // TODO(scheib): UI to select and permit access to a device crbug.com/436280. |
| 177 // This will include refactoring messages to be associated with an origin | 182 // This will include refactoring messages to be associated with an origin |
| 178 // and making this initial requestDevice call with an associated frame. | 183 // and making this initial requestDevice call with an associated frame. |
| 179 // This work is deferred to simplify initial prototype patches. | 184 // This work is deferred to simplify initial prototype patches. |
| 180 // The Bluetooth feature, and the BluetoothDispatcherHost are behind | 185 // The Bluetooth feature, and the BluetoothDispatcherHost are behind |
| 181 // the --enable-experimental-web-platform-features flag. | 186 // the --enable-experimental-web-platform-features flag. |
| 182 IPC_MESSAGE_CONTROL2(BluetoothHostMsg_RequestDevice, | 187 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_RequestDevice, |
| 183 int /* thread_id */, | 188 int /* thread_id */, |
| 184 int /* request_id */) | 189 int /* request_id */, |
| 190 std::vector<content::BluetoothScanFilter>, |
| 191 std::vector<device::BluetoothUUID> /* optional_services */) |
| 185 | 192 |
| 186 // Connects to a bluetooth device. | 193 // Connects to a bluetooth device. |
| 187 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ConnectGATT, | 194 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ConnectGATT, |
| 188 int /* thread_id */, | 195 int /* thread_id */, |
| 189 int /* request_id */, | 196 int /* request_id */, |
| 190 std::string /* device_instance_id */) | 197 std::string /* device_instance_id */) |
| 191 | 198 |
| 192 // Gets primary service from bluetooth device. | 199 // Gets primary service from bluetooth device. |
| 193 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetPrimaryService, | 200 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetPrimaryService, |
| 194 int /* thread_id */, | 201 int /* thread_id */, |
| 195 int /* request_id */, | 202 int /* request_id */, |
| 196 std::string /* device_instance_id */, | 203 std::string /* device_instance_id */, |
| 197 std::string /* service_uuid */) | 204 std::string /* service_uuid */) |
| 198 | 205 |
| 199 // Gets a GATT Characteristic within a GATT Service. | 206 // Gets a GATT Characteristic within a GATT Service. |
| 200 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetCharacteristic, | 207 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetCharacteristic, |
| 201 int /* thread_id */, | 208 int /* thread_id */, |
| 202 int /* request_id */, | 209 int /* request_id */, |
| 203 std::string /* service_instance_id */, | 210 std::string /* service_instance_id */, |
| 204 std::string /* characteristic_uuid */) | 211 std::string /* characteristic_uuid */) |
| 205 | 212 |
| 206 // Reads the characteristics value from a bluetooth device. | 213 // Reads the characteristics value from a bluetooth device. |
| 207 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ReadValue, | 214 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ReadValue, |
| 208 int /* thread_id */, | 215 int /* thread_id */, |
| 209 int /* request_id */, | 216 int /* request_id */, |
| 210 std::string /* characteristic_instance_id */) | 217 std::string /* characteristic_instance_id */) |
| OLD | NEW |