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

Unified Diff: content/browser/bluetooth/bluetooth_dispatcher_host.h

Issue 1502663003: bluetooth: Implement allowed devices map (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Forgot test file Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/bluetooth_dispatcher_host.h
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.h b/content/browser/bluetooth/bluetooth_dispatcher_host.h
index 20170af61b7441643c76bc7ff900927f98709119..9a6016d6fcd43796b7488d2821fc9e4b1e191d64 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.h
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.h
@@ -11,6 +11,7 @@
#include "base/id_map.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
+#include "content/browser/bluetooth/bluetooth_allowed_devices_map.h"
#include "content/public/browser/bluetooth_chooser.h"
#include "content/public/browser/browser_message_filter.h"
#include "device/bluetooth/bluetooth_adapter.h"
@@ -102,33 +103,42 @@ class CONTENT_EXPORT BluetoothDispatcherHost final
const std::vector<device::BluetoothUUID>& optional_services);
void OnConnectGATT(int thread_id,
int request_id,
+ int frame_routing_id,
const std::string& device_id);
void OnGetPrimaryService(int thread_id,
int request_id,
+ int frame_routing_id,
const std::string& device_id,
const std::string& service_uuid);
void OnGetCharacteristic(int thread_id,
int request_id,
+ int frame_routing_id,
const std::string& service_instance_id,
const std::string& characteristic_uuid);
void OnReadValue(int thread_id,
int request_id,
+ int frame_routing_id,
const std::string& characteristic_instance_id);
void OnWriteValue(int thread_id,
int request_id,
+ int frame_routing_id,
const std::string& characteristic_instance_id,
const std::vector<uint8_t>& value);
void OnStartNotifications(int thread_id,
int request_id,
+ int frame_routing_id,
const std::string& characteristic_instance_id);
void OnStopNotifications(int thread_id,
int request_id,
+ int frame_routing_id,
const std::string& characteristic_instance_id);
void OnRegisterCharacteristicObject(
int thread_id,
+ int frame_routing_id,
const std::string& characteristic_instance_id);
void OnUnregisterCharacteristicObject(
int thread_id,
+ int frame_routing_id,
const std::string& characteristic_instance_id);
// Callbacks for BluetoothAdapter::StartDiscoverySession.
@@ -208,30 +218,36 @@ class CONTENT_EXPORT BluetoothDispatcherHost final
// was already recorded and since there renderer crashed there is no need to
// send a response.
- // Queries the platform cache for a Device with |device_id|. Fills in the
- // |outcome| field and the |device| field if successful.
- CacheQueryResult QueryCacheForDevice(const std::string& device_id);
+ // Queries the platform cache for a Device with |device_id| for |origin|.
+ // Fills in the |outcome| field and the |device| field if successful.
+ CacheQueryResult QueryCacheForDevice(const std::string& origin,
+ const std::string& device_id);
// Queries the platform cache for a Service with |service_instance_id|. Fills
// in the |outcome| field, and |device| and |service| fields if successful.
- CacheQueryResult QueryCacheForService(const std::string& service_instance_id);
+ CacheQueryResult QueryCacheForService(const std::string& origin,
+ const std::string& service_instance_id);
// Queries the platform cache for a characteristic with
// |characteristic_instance_id|. Fills in the |outcome| field, and |device|,
// |service| and |characteristic| fields if successful.
CacheQueryResult QueryCacheForCharacteristic(
+ const std::string& origin,
const std::string& characteristic_instance_id);
// Returns true if all services have been discovered for the device.
// When the host gets a ServiceChanged indication, it automatically
// re-discovers services, and only forwards the ServiceChanged event to this
// class when it's done re-discovering.
- bool IsServicesDiscoveryCompleteForDevice(const std::string& device_id);
+ bool IsServicesDiscoveryCompleteForDevice(const std::string& device_address);
// Adds the PrimaryServicesRequest to the vector of pending services requests
// for that device.
void AddToPendingPrimaryServicesRequest(
- const std::string& device_id,
+ const std::string& device_address,
const PrimaryServicesRequest& request);
+ // Returns the origin for the frame with "frame_rounting_id" in this process.
Jeffrey Yasskin 2016/01/06 00:47:57 sp: rounting
Jeffrey Yasskin 2016/01/06 00:47:57 s/this process/render_process_id_/
ortuno 2016/01/13 01:41:44 Done. On 2016/01/06 at 00:47:57, Jeffrey Yasskin
+ std::string GetOrigin(int frame_routing_id);
+
// Show help pages from the chooser dialog.
void ShowBluetoothOverviewLink();
void ShowBluetoothPairingLink();
@@ -246,8 +262,10 @@ class CONTENT_EXPORT BluetoothDispatcherHost final
// again everywhere a requestDevice() reply is sent.
IDMap<RequestDeviceSession, IDMapOwnPointer> request_device_sessions_;
+ BluetoothAllowedDevicesMap allowed_devices_map_;
+
// Maps to get the object's parent based on it's instanceID
- // Map of service_instance_id to device_id.
+ // Map of service_instance_id to device_address.
std::map<std::string, std::string> service_to_device_;
// Map of characteristic_instance_id to service_instance_id.
std::map<std::string, std::string> characteristic_to_service_;
@@ -283,8 +301,8 @@ class CONTENT_EXPORT BluetoothDispatcherHost final
// Keeps track of which devices have had their services discovered.
std::set<std::string> devices_with_discovered_services_;
- // Map of device_id's to primary-services requests that need responses when
- // that device's service discovery completes.
+ // Map of device_address's to primary-services requests that need responses
+ // when that device's service discovery completes.
std::map<std::string, std::vector<PrimaryServicesRequest>>
pending_primary_services_requests_;

Powered by Google App Engine
This is Rietveld 408576698