| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Messages for Web Bluetooth API. |
| 6 // Multiply-included message file, hence no include guard. |
| 7 |
| 8 // Web Bluetooth Security |
| 9 // The security mechanisms of Bluetooth are described in the specification: |
| 10 // https://webbluetoothcg.github.io/web-bluetooth |
| 11 // |
| 12 // Exerpts: |
| 13 // |
| 14 // From: Security and privacy considerations |
| 15 // http://webbluetoothcg.github.io/web-bluetooth/#security-and-privacy-considera
tions |
| 16 // """ |
| 17 // When a website requests access to devices using requestDevice, it gets the |
| 18 // ability to access all GATT services mentioned in the call. The UA must inform |
| 19 // the user what capabilities these services give the website before asking |
| 20 // which devices to entrust to it. If any services in the list aren't known to |
| 21 // the UA, the UA must assume they give the site complete control over the |
| 22 // device and inform the user of this risk. The UA must also allow the user to |
| 23 // inspect what sites have access to what devices and revoke these pairings. |
| 24 // |
| 25 // The UA must not allow the user to pair entire classes of devices with a |
| 26 // website. It is possible to construct a class of devices for which each |
| 27 // individual device sends the same Bluetooth-level identifying information. UAs |
| 28 // are not required to attempt to detect this sort of forgery and may let a user |
| 29 // pair this pseudo-device with a website. |
| 30 // |
| 31 // To help ensure that only the entity the user approved for access actually has |
| 32 // access, this specification requires that only authenticated environments can |
| 33 // access Bluetooth devices (requestDevice). |
| 34 // """ |
| 35 // |
| 36 // From: Device Discovery: |
| 37 // """ |
| 38 // The UA must maintain an allowed devices list for each origin, storing a set |
| 39 // of Bluetooth devices the origin is allowed to access. For each device in the |
| 40 // allowed devices list for an origin, the UA must maintain an allowed services |
| 41 // list consisting of UUIDs for GATT Primary Services the origin is allowed to |
| 42 // access on the device. The UA may remove devices from the allowed devices list |
| 43 // at any time based on signals from the user. For example, if the user chooses |
| 44 // not to remember access, the UA might remove a device when the tab that was |
| 45 // granted access to it is closed. Or the UA might provide a revocation UI that |
| 46 // allows the user to explicitly remove a device even while a tab is actively |
| 47 // using that device. If a device is removed from this list while a Promise is |
| 48 // pending to do something with the device, it must be treated the same as if |
| 49 // the device moved out of Bluetooth range. |
| 50 // """ |
| 51 // |
| 52 // From: Device Discovery: requestDevice |
| 53 // http://webbluetoothcg.github.io/web-bluetooth/#device-discovery |
| 54 // """ |
| 55 // Display a prompt to the user requesting that the user specify some devices |
| 56 // from the result of the scan. The UA should show the user the human-readable |
| 57 // name of each device. If this name is not available because the UA's Bluetooth |
| 58 // system doesn't support privacy-enabled scans, the UA should allow the user to |
| 59 // indicate interest and then perform a privacy-disabled scan to retrieve the |
| 60 // name. |
| 61 // |
| 62 // The UA may allow the user to select a nearby device that does not match |
| 63 // filters. |
| 64 // |
| 65 // Wait for the user to have made their selection. |
| 66 // |
| 67 // If the user cancels the prompt, reject the Promise with a NotFoundError and |
| 68 // abort these steps. |
| 69 // |
| 70 // Record the selected device in the origin's allowed devices list and the union |
| 71 // of the service UUIDs from filters and options.optionalServices in the device |
| 72 // and origin's allowed services list. |
| 73 // |
| 74 // Connect to the device. ([BLUETOOTH41] 3.G.6.2.1) If the connection fails, |
| 75 // reject the Promise with a NetworkError and abort these steps. |
| 76 // |
| 77 // Resolve the Promise with a BluetoothDevice instance representing the selected |
| 78 // device. |
| 79 // """ |
| 80 |
| 81 #include "ipc/ipc_message_macros.h" |
| 82 #include "content/common/bluetooth/bluetooth_error.h" |
| 83 |
| 84 #define IPC_MESSAGE_START BluetoothMsgStart |
| 85 |
| 86 IPC_ENUM_TRAITS_MAX_VALUE(content::BluetoothError, |
| 87 content::BluetoothError::ENUM_MAX_VALUE) |
| 88 |
| 89 // Messages sent from the browser to the renderer. |
| 90 |
| 91 // Informs the renderer that the device request |request_id| succeeded. |
| 92 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceSuccess, |
| 93 int /* thread_id */, |
| 94 int /* request_id */, |
| 95 std::string /* device_instance_id */) |
| 96 |
| 97 // Informs the renderer that the device request |request_id| failed. |
| 98 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceError, |
| 99 int /* thread_id */, |
| 100 int /* request_id */, |
| 101 content::BluetoothError /* result */) |
| 102 |
| 103 // Messages sent from the renderer to the browser. |
| 104 |
| 105 // Requests a bluetooth device from the browser. |
| 106 // TODO(scheib): UI to select and permit access to a device crbug.com/436280. |
| 107 // This will include refactoring messages to be associated with an origin |
| 108 // and making this initial requestDevice call with an associated frame. |
| 109 // This work is deferred to simplify initial prototype patches. |
| 110 // The Bluetooth feature, and the BluetoothDispatcherHost are behind |
| 111 // the --enable-experimental-web-platform-features flag. |
| 112 IPC_MESSAGE_CONTROL2(BluetoothHostMsg_RequestDevice, |
| 113 int /* thread_id */, |
| 114 int /* request_id */) |
| 115 |
| 116 // Configures the mock data set in the browser used while under test. |
| 117 // TODO(scheib): Disable testing in non-test executables. crbug.com/436284. |
| 118 IPC_MESSAGE_CONTROL1(BluetoothHostMsg_SetBluetoothMockDataSetForTesting, |
| 119 std::string /* name */) |
| OLD | NEW |