Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: content/common/bluetooth/bluetooth_messages.h

Issue 1922923002: bluetooth: Move requestDevice to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-tests-request-device
Patch Set: Change ref to pointer Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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://webbluetoothchrome.github.io/web-bluetooth
11 //
12 // Exerpts:
13 //
14 // From: Security and privacy considerations
15 // http://webbluetoothchrome.github.io/web-bluetooth/#security-and-privacy-consi derations
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: Per-origin Bluetooth device properties:
37 // """
38 // For each origin, the UA must maintain an allowed devices map, whose keys are
39 // the Bluetooth devices the origin is allowed to access, and whose values are
40 // pairs of a DOMString device id and an allowed services list consisting of
41 // UUIDs for GATT Primary Services the origin is allowed to access on the
42 // device.
43 //
44 // The UA may remove devices from the allowed devices map at any time based on
45 // signals from the user. This needs a definition involving removing
46 // BluetoothDevice instances from device instance maps and clearing out their
47 // [[representedDevice]] fields. For example, if the user chooses not to
48 // remember access, the UA might remove a device when the tab that was granted
49 // access to it is closed. Or the UA might provide a revocation UI that allows
50 // the user to explicitly remove a device even while a tab is actively using
51 // that device. If a device is removed from this list while a Promise is pending
52 // to do something with the device, it must be treated the same as if the device
53 // moved out of Bluetooth range.
54 // """
55 //
56 // From: Device Discovery: requestDevice
57 // http://webbluetoothchrome.github.io/web-bluetooth/#device-discovery
58 // """
59 // Even if scanResult is empty, display a prompt to the user requesting that the
60 // user select a device from it. The UA should show the user the human-readable
61 // name of each device. If this name is not available because the UA's Bluetooth
62 // system doesn't support privacy-enabled scans, the UA should allow the user to
63 // indicate interest and then perform a privacy-disabled scan to retrieve the
64 // name.
65 //
66 // The UA may allow the user to select a nearby device that does not match
67 // filters.
68 //
69 // Wait for the user to have selected a device or cancelled the prompt.
70 //
71 // If the user cancels the prompt, reject promise with a NotFoundError and abort
72 // these steps.
73 //
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.
76 //
77 // Get the BluetoothDevice representing device and resolve promise with the
78 // result.
79 // """
80
81 #include "ipc/ipc_message_macros.h"
82
83 #include <stdint.h>
84
85 #include "content/common/bluetooth/bluetooth_device.h"
86 #include "content/common/bluetooth/bluetooth_scan_filter.h"
87 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothError .h"
88
89 #define IPC_MESSAGE_START BluetoothMsgStart
90
91 IPC_STRUCT_TRAITS_BEGIN(content::BluetoothDevice)
92 IPC_STRUCT_TRAITS_MEMBER(id)
93 IPC_STRUCT_TRAITS_MEMBER(name)
94 IPC_STRUCT_TRAITS_MEMBER(uuids)
95 IPC_STRUCT_TRAITS_END()
96
97 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebBluetoothError,
98 blink::WebBluetoothError::ENUM_MAX_VALUE)
99
100 IPC_STRUCT_TRAITS_BEGIN(content::BluetoothScanFilter)
101 IPC_STRUCT_TRAITS_MEMBER(services)
102 IPC_STRUCT_TRAITS_MEMBER(name)
103 IPC_STRUCT_TRAITS_MEMBER(namePrefix)
104 IPC_STRUCT_TRAITS_END()
105
106 // Messages sent from the browser to the renderer.
107
108 // Informs the renderer that the device request |request_id| succeeded.
109 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceSuccess,
110 int /* thread_id */,
111 int /* request_id */,
112 content::BluetoothDevice /* device */)
113
114 // Informs the renderer that the device request |request_id| failed.
115 IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceError,
116 int /* thread_id */,
117 int /* request_id */,
118 blink::WebBluetoothError /* result */)
119
120 // Messages sent from the renderer to the browser.
121
122 // Requests a bluetooth device from the browser.
123 IPC_MESSAGE_CONTROL5(BluetoothHostMsg_RequestDevice,
124 int /* thread_id */,
125 int /* request_id */,
126 int /* frame_routing_id */,
127 std::vector<content::BluetoothScanFilter>,
128 std::vector<device::BluetoothUUID> /* optional_services */)
OLDNEW
« no previous file with comments | « content/common/bluetooth/bluetooth_device.cc ('k') | content/common/bluetooth/bluetooth_scan_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698