We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / content / common / bluetooth / bluetooth_messages.h
bloba89404a2bdee2ebdd3275e54497187df17d2bdd0
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.
5 // Messages for Web Bluetooth API.
6 // Multiply-included message file, hence no include guard.
8 // Web Bluetooth Security
9 // The security mechanisms of Bluetooth are described in the specification:
10 // https://webbluetoothcg.github.io/web-bluetooth
12 // Exerpts:
14 // From: Security and privacy considerations
15 // http://webbluetoothcg.github.io/web-bluetooth/#security-and-privacy-considerations
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.
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.
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 // """
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 // """
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.
62 // The UA may allow the user to select a nearby device that does not match
63 // filters.
65 // Wait for the user to have made their selection.
67 // If the user cancels the prompt, reject the Promise with a NotFoundError and
68 // abort these steps.
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.
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.
77 // Resolve the Promise with a BluetoothDevice instance representing the selected
78 // device.
79 // """
81 #include "ipc/ipc_message_macros.h"
82 #include "content/common/bluetooth/bluetooth_device.h"
83 #include "content/common/bluetooth/bluetooth_error.h"
85 #define IPC_MESSAGE_START BluetoothMsgStart
87 IPC_ENUM_TRAITS_MAX_VALUE(
88 device::BluetoothDevice::VendorIDSource,
89 device::BluetoothDevice::VendorIDSource::VENDOR_ID_MAX_VALUE)
91 IPC_STRUCT_TRAITS_BEGIN(content::BluetoothDevice)
92 IPC_STRUCT_TRAITS_MEMBER(instance_id)
93 IPC_STRUCT_TRAITS_MEMBER(name)
94 IPC_STRUCT_TRAITS_MEMBER(device_class)
95 IPC_STRUCT_TRAITS_MEMBER(vendor_id_source)
96 IPC_STRUCT_TRAITS_MEMBER(vendor_id)
97 IPC_STRUCT_TRAITS_MEMBER(product_id)
98 IPC_STRUCT_TRAITS_MEMBER(product_version)
99 IPC_STRUCT_TRAITS_MEMBER(paired)
100 IPC_STRUCT_TRAITS_MEMBER(connected)
101 IPC_STRUCT_TRAITS_MEMBER(uuids)
102 IPC_STRUCT_TRAITS_END()
104 IPC_ENUM_TRAITS_MAX_VALUE(content::BluetoothError,
105 content::BluetoothError::ENUM_MAX_VALUE)
107 // Messages sent from the browser to the renderer.
109 // Informs the renderer that the device request |request_id| succeeded.
110 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceSuccess,
111 int /* thread_id */,
112 int /* request_id */,
113 content::BluetoothDevice /* device */)
115 // Informs the renderer that the device request |request_id| failed.
116 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceError,
117 int /* thread_id */,
118 int /* request_id */,
119 content::BluetoothError /* result */)
121 // Messages sent from the renderer to the browser.
123 // Requests a bluetooth device from the browser.
124 // TODO(scheib): UI to select and permit access to a device crbug.com/436280.
125 // This will include refactoring messages to be associated with an origin
126 // and making this initial requestDevice call with an associated frame.
127 // This work is deferred to simplify initial prototype patches.
128 // The Bluetooth feature, and the BluetoothDispatcherHost are behind
129 // the --enable-experimental-web-platform-features flag.
130 IPC_MESSAGE_CONTROL2(BluetoothHostMsg_RequestDevice,
131 int /* thread_id */,
132 int /* request_id */)
134 // Configures the mock data set in the browser used while under test.
135 // TODO(scheib): Disable testing in non-test executables. crbug.com/436284.
136 IPC_MESSAGE_CONTROL1(BluetoothHostMsg_SetBluetoothMockDataSetForTesting,
137 std::string /* name */)