| 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 27 matching lines...) Expand all Loading... |
| 143 | 148 |
| 144 // Messages sent from the renderer to the browser. | 149 // Messages sent from the renderer to the browser. |
| 145 | 150 |
| 146 // Requests a bluetooth device from the browser. | 151 // Requests a bluetooth device from the browser. |
| 147 // TODO(scheib): UI to select and permit access to a device crbug.com/436280. | 152 // TODO(scheib): UI to select and permit access to a device crbug.com/436280. |
| 148 // This will include refactoring messages to be associated with an origin | 153 // This will include refactoring messages to be associated with an origin |
| 149 // and making this initial requestDevice call with an associated frame. | 154 // and making this initial requestDevice call with an associated frame. |
| 150 // This work is deferred to simplify initial prototype patches. | 155 // This work is deferred to simplify initial prototype patches. |
| 151 // The Bluetooth feature, and the BluetoothDispatcherHost are behind | 156 // The Bluetooth feature, and the BluetoothDispatcherHost are behind |
| 152 // the --enable-experimental-web-platform-features flag. | 157 // the --enable-experimental-web-platform-features flag. |
| 153 IPC_MESSAGE_CONTROL2(BluetoothHostMsg_RequestDevice, | 158 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_RequestDevice, |
| 154 int /* thread_id */, | 159 int /* thread_id */, |
| 155 int /* request_id */) | 160 int /* request_id */, |
| 161 std::vector<content::BluetoothScanFilter>, |
| 162 std::vector<device::BluetoothUUID> /* optional_services */) |
| 156 | 163 |
| 157 // Connects to a bluetooth device. | 164 // Connects to a bluetooth device. |
| 158 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ConnectGATT, | 165 IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ConnectGATT, |
| 159 int /* thread_id */, | 166 int /* thread_id */, |
| 160 int /* request_id */, | 167 int /* request_id */, |
| 161 std::string /* device_instance_id */) | 168 std::string /* device_instance_id */) |
| 162 | 169 |
| 163 // Gets primary service from bluetooth device. | 170 // Gets primary service from bluetooth device. |
| 164 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetPrimaryService, | 171 IPC_MESSAGE_CONTROL4(BluetoothHostMsg_GetPrimaryService, |
| 165 int /* thread_id */, | 172 int /* thread_id */, |
| 166 int /* request_id */, | 173 int /* request_id */, |
| 167 std::string /* device_instance_id */, | 174 std::string /* device_instance_id */, |
| 168 std::string /* service_uuid */) | 175 std::string /* service_uuid */) |
| OLD | NEW |