diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-06-18 14:10:49 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-06-18 13:53:24 +0000 |
commit | 813fbf95af77a531c57a8c497345ad2c61d475b3 (patch) | |
tree | 821b2c8de8365f21b6c9ba17a236fb3006a1d506 /chromium/content/common/bluetooth | |
parent | af6588f8d723931a298c995fa97259bb7f7deb55 (diff) | |
download | qtwebengine-chromium-813fbf95af77a531c57a8c497345ad2c61d475b3.tar.gz |
BASELINE: Update chromium to 44.0.2403.47
Change-Id: Ie056fedba95cf5e5c76b30c4b2c80fca4764aa2f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/content/common/bluetooth')
-rw-r--r-- | chromium/content/common/bluetooth/DEPS | 4 | ||||
-rw-r--r-- | chromium/content/common/bluetooth/OWNERS | 14 | ||||
-rw-r--r-- | chromium/content/common/bluetooth/PRESUBMIT.py | 14 | ||||
-rw-r--r-- | chromium/content/common/bluetooth/bluetooth_device.cc | 58 | ||||
-rw-r--r-- | chromium/content/common/bluetooth/bluetooth_device.h | 48 | ||||
-rw-r--r-- | chromium/content/common/bluetooth/bluetooth_error.h | 21 | ||||
-rw-r--r-- | chromium/content/common/bluetooth/bluetooth_messages.h | 148 |
7 files changed, 307 insertions, 0 deletions
diff --git a/chromium/content/common/bluetooth/DEPS b/chromium/content/common/bluetooth/DEPS new file mode 100644 index 00000000000..2c5a329542a --- /dev/null +++ b/chromium/content/common/bluetooth/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + "+device/bluetooth", +] + diff --git a/chromium/content/common/bluetooth/OWNERS b/chromium/content/common/bluetooth/OWNERS new file mode 100644 index 00000000000..aae325e5f14 --- /dev/null +++ b/chromium/content/common/bluetooth/OWNERS @@ -0,0 +1,14 @@ +scheib@chromium.org + +# For security review of IPC message files. +per-file *_messages*.h=set noparent +per-file *_messages*.h=dcheng@chromium.org +per-file *_messages*.h=inferno@chromium.org +per-file *_messages*.h=jln@chromium.org +per-file *_messages*.h=jschuh@chromium.org +per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org +per-file *_messages*.h=nasko@chromium.org +per-file *_messages*.h=palmer@chromium.org +per-file *_messages*.h=tsepez@chromium.org +per-file *_messages*.h=wfh@chromium.org diff --git a/chromium/content/common/bluetooth/PRESUBMIT.py b/chromium/content/common/bluetooth/PRESUBMIT.py new file mode 100644 index 00000000000..3f9babedbd6 --- /dev/null +++ b/chromium/content/common/bluetooth/PRESUBMIT.py @@ -0,0 +1,14 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Presubmit script. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into depot_tools. +""" + +def CheckChangeOnUpload(input_api, output_api): + results = [] + results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) + return results diff --git a/chromium/content/common/bluetooth/bluetooth_device.cc b/chromium/content/common/bluetooth/bluetooth_device.cc new file mode 100644 index 00000000000..ee9a087291d --- /dev/null +++ b/chromium/content/common/bluetooth/bluetooth_device.cc @@ -0,0 +1,58 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/bluetooth/bluetooth_device.h" + +#include "base/strings/string_util.h" + +namespace content { + +BluetoothDevice::BluetoothDevice() + : instance_id(""), + name(base::string16()), + device_class(0), + vendor_id_source( + device::BluetoothDevice::VendorIDSource::VENDOR_ID_UNKNOWN), + vendor_id(0), + product_id(0), + product_version(0), + paired(false), + uuids() { +} + +BluetoothDevice::BluetoothDevice( + const std::string& instance_id, + const base::string16& name, + uint32 device_class, + device::BluetoothDevice::VendorIDSource vendor_id_source, + uint16 vendor_id, + uint16 product_id, + uint16 product_version, + bool paired, + const std::vector<std::string>& uuids) + : instance_id(instance_id), + name(name), + device_class(device_class), + vendor_id_source(vendor_id_source), + vendor_id(vendor_id), + product_id(product_id), + product_version(product_version), + paired(paired), + uuids(uuids) { +} + +BluetoothDevice::~BluetoothDevice() { +} + +// static +std::vector<std::string> BluetoothDevice::UUIDsFromBluetoothUUIDs( + const device::BluetoothDevice::UUIDList& uuid_list) { + std::vector<std::string> uuids; + uuids.reserve(uuid_list.size()); + for (const auto& it : uuid_list) + uuids.push_back(it.canonical_value()); + return uuids; +} + +} // namespace content diff --git a/chromium/content/common/bluetooth/bluetooth_device.h b/chromium/content/common/bluetooth/bluetooth_device.h new file mode 100644 index 00000000000..987477626e2 --- /dev/null +++ b/chromium/content/common/bluetooth/bluetooth_device.h @@ -0,0 +1,48 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ +#define CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ + +#include <string> + +#include "base/basictypes.h" +#include "base/strings/string16.h" +#include "content/common/content_export.h" +#include "device/bluetooth/bluetooth_device.h" + +namespace content { + +// Data sent over IPC representing a Bluetooth device, corresponding to +// blink::WebBluetoothDevice. +struct CONTENT_EXPORT BluetoothDevice { + BluetoothDevice(); + BluetoothDevice(const std::string& instance_id, + const base::string16& name, + uint32 device_class, + device::BluetoothDevice::VendorIDSource vendor_id_source, + uint16 vendor_id, + uint16 product_id, + uint16 product_version, + bool paired, + const std::vector<std::string>& uuids); + ~BluetoothDevice(); + + static std::vector<std::string> UUIDsFromBluetoothUUIDs( + const device::BluetoothDevice::UUIDList& uuid_list); + + std::string instance_id; + base::string16 name; + uint32 device_class; + device::BluetoothDevice::VendorIDSource vendor_id_source; + uint16 vendor_id; + uint16 product_id; + uint16 product_version; + bool paired; + std::vector<std::string> uuids; // 128bit UUIDs with dashes. 36 chars. +}; + +} // namespace content + +#endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ diff --git a/chromium/content/common/bluetooth/bluetooth_error.h b/chromium/content/common/bluetooth/bluetooth_error.h new file mode 100644 index 00000000000..7ebf7aef8c1 --- /dev/null +++ b/chromium/content/common/bluetooth/bluetooth_error.h @@ -0,0 +1,21 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_BLUETOOTH_BLUETOOTH_ERROR_H_ +#define CONTENT_COMMON_BLUETOOTH_BLUETOOTH_ERROR_H_ + +namespace content { + +// Error enumerations corresponding to blink::WebBluetoothError::ErrorType +// used to create DOMExceptions. +enum class BluetoothError { + NOT_FOUND, + NETWORK_ERROR, + SECURITY, + ENUM_MAX_VALUE = SECURITY +}; + +} // namespace content + +#endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_ERROR_H_ diff --git a/chromium/content/common/bluetooth/bluetooth_messages.h b/chromium/content/common/bluetooth/bluetooth_messages.h new file mode 100644 index 00000000000..dda97d42eda --- /dev/null +++ b/chromium/content/common/bluetooth/bluetooth_messages.h @@ -0,0 +1,148 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Messages for Web Bluetooth API. +// Multiply-included message file, hence no include guard. + +// Web Bluetooth Security +// The security mechanisms of Bluetooth are described in the specification: +// https://webbluetoothcg.github.io/web-bluetooth +// +// Exerpts: +// +// From: Security and privacy considerations +// http://webbluetoothcg.github.io/web-bluetooth/#security-and-privacy-considerations +// """ +// When a website requests access to devices using requestDevice, it gets the +// ability to access all GATT services mentioned in the call. The UA must inform +// the user what capabilities these services give the website before asking +// which devices to entrust to it. If any services in the list aren't known to +// the UA, the UA must assume they give the site complete control over the +// device and inform the user of this risk. The UA must also allow the user to +// inspect what sites have access to what devices and revoke these pairings. +// +// The UA must not allow the user to pair entire classes of devices with a +// website. It is possible to construct a class of devices for which each +// individual device sends the same Bluetooth-level identifying information. UAs +// are not required to attempt to detect this sort of forgery and may let a user +// pair this pseudo-device with a website. +// +// To help ensure that only the entity the user approved for access actually has +// access, this specification requires that only authenticated environments can +// access Bluetooth devices (requestDevice). +// """ +// +// From: Per-origin Bluetooth device properties: +// """ +// For each origin, the UA must maintain an allowed devices map, whose keys are +// the Bluetooth devices the origin is allowed to access, and whose values are +// pairs of a DOMString device id and an allowed services list consisting of +// UUIDs for GATT Primary Services the origin is allowed to access on the +// device. +// +// The UA may remove devices from the allowed devices map at any time based on +// signals from the user. This needs a definition involving removing +// BluetoothDevice instances from device instance maps and clearing out their +// [[representedDevice]] fields. For example, if the user chooses not to +// remember access, the UA might remove a device when the tab that was granted +// access to it is closed. Or the UA might provide a revocation UI that allows +// the user to explicitly remove a device even while a tab is actively using +// that device. If a device is removed from this list while a Promise is pending +// to do something with the device, it must be treated the same as if the device +// moved out of Bluetooth range. +// """ +// +// From: Device Discovery: requestDevice +// http://webbluetoothcg.github.io/web-bluetooth/#device-discovery +// """ +// Even if scanResult is empty, display a prompt to the user requesting that the +// user select a device from it. The UA should show the user the human-readable +// name of each device. If this name is not available because the UA's Bluetooth +// system doesn't support privacy-enabled scans, the UA should allow the user to +// indicate interest and then perform a privacy-disabled scan to retrieve the +// name. +// +// The UA may allow the user to select a nearby device that does not match +// filters. +// +// Wait for the user to have selected a device or cancelled the prompt. +// +// If the user cancels the prompt, reject promise with a NotFoundError and abort +// these steps. +// +// Add device to the origin's allowed devices map. with the union of the service +// UUIDs from filters and options.optionalServices as allowed services. +// +// Get the BluetoothDevice representing device and resolve promise with the +// result. +// """ + +#include "ipc/ipc_message_macros.h" +#include "content/common/bluetooth/bluetooth_device.h" +#include "content/common/bluetooth/bluetooth_error.h" + +#define IPC_MESSAGE_START BluetoothMsgStart + +IPC_ENUM_TRAITS_MAX_VALUE( + device::BluetoothDevice::VendorIDSource, + device::BluetoothDevice::VendorIDSource::VENDOR_ID_MAX_VALUE) + +IPC_STRUCT_TRAITS_BEGIN(content::BluetoothDevice) +IPC_STRUCT_TRAITS_MEMBER(instance_id) +IPC_STRUCT_TRAITS_MEMBER(name) +IPC_STRUCT_TRAITS_MEMBER(device_class) +IPC_STRUCT_TRAITS_MEMBER(vendor_id_source) +IPC_STRUCT_TRAITS_MEMBER(vendor_id) +IPC_STRUCT_TRAITS_MEMBER(product_id) +IPC_STRUCT_TRAITS_MEMBER(product_version) +IPC_STRUCT_TRAITS_MEMBER(paired) +IPC_STRUCT_TRAITS_MEMBER(uuids) +IPC_STRUCT_TRAITS_END() + +IPC_ENUM_TRAITS_MAX_VALUE(content::BluetoothError, + content::BluetoothError::ENUM_MAX_VALUE) + +// Messages sent from the browser to the renderer. + +// Informs the renderer that the device request |request_id| succeeded. +IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceSuccess, + int /* thread_id */, + int /* request_id */, + content::BluetoothDevice /* device */) + +// Informs the renderer that the device request |request_id| failed. +IPC_MESSAGE_CONTROL3(BluetoothMsg_RequestDeviceError, + int /* thread_id */, + int /* request_id */, + content::BluetoothError /* result */) + +// Informs the renderer that the connection request |request_id| succeeded. +IPC_MESSAGE_CONTROL3(BluetoothMsg_ConnectGATTSuccess, + int /* thread_id */, + int /* request_id */, + std::string /* device_instance_id */) + +// Messages sent from the renderer to the browser. + +// Requests a bluetooth device from the browser. +// TODO(scheib): UI to select and permit access to a device crbug.com/436280. +// This will include refactoring messages to be associated with an origin +// and making this initial requestDevice call with an associated frame. +// This work is deferred to simplify initial prototype patches. +// The Bluetooth feature, and the BluetoothDispatcherHost are behind +// the --enable-experimental-web-platform-features flag. +IPC_MESSAGE_CONTROL2(BluetoothHostMsg_RequestDevice, + int /* thread_id */, + int /* request_id */) + +// Connects to a bluetooth device. +IPC_MESSAGE_CONTROL3(BluetoothHostMsg_ConnectGATT, + int /* thread_id */, + int /* request_id */, + std::string /* device_instance_id */) + +// Configures the mock data set in the browser used while under test. +// TODO(scheib): Disable testing in non-test executables. crbug.com/436284. +IPC_MESSAGE_CONTROL1(BluetoothHostMsg_SetBluetoothMockDataSetForTesting, + std::string /* name */) |