OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_ |
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const std::string& service_uuid) const; | 61 const std::string& service_uuid) const; |
62 | 62 |
63 private: | 63 private: |
64 typedef std::map<std::string, std::string> DeviceAddressToIdMap; | 64 typedef std::map<std::string, std::string> DeviceAddressToIdMap; |
65 typedef std::map<std::string, std::string> DeviceIdToAddressMap; | 65 typedef std::map<std::string, std::string> DeviceIdToAddressMap; |
66 typedef std::map<std::string, std::set<std::string>> DeviceIdToServicesMap; | 66 typedef std::map<std::string, std::set<std::string>> DeviceIdToServicesMap; |
67 | 67 |
68 // Returns an id guaranteed to be unique for the map. The id is randomly | 68 // Returns an id guaranteed to be unique for the map. The id is randomly |
69 // generated so that an origin can't guess the id used in another origin. | 69 // generated so that an origin can't guess the id used in another origin. |
70 std::string GenerateDeviceId(); | 70 std::string GenerateDeviceId(); |
71 std::set<std::string> UnionOfServices( | 71 void AddUnionOfServicesTo( |
72 const std::vector<BluetoothScanFilter>& filters, | 72 const std::vector<BluetoothScanFilter>& filters, |
73 const std::vector<device::BluetoothUUID>& optional_services); | 73 const std::vector<device::BluetoothUUID>& optional_services, |
| 74 std::set<std::string>* unionOfServices); |
74 | 75 |
75 std::map<url::Origin, DeviceAddressToIdMap> | 76 std::map<url::Origin, DeviceAddressToIdMap> |
76 origin_to_device_address_to_id_map_; | 77 origin_to_device_address_to_id_map_; |
77 std::map<url::Origin, DeviceIdToAddressMap> | 78 std::map<url::Origin, DeviceIdToAddressMap> |
78 origin_to_device_id_to_address_map_; | 79 origin_to_device_id_to_address_map_; |
79 std::map<url::Origin, DeviceIdToServicesMap> | 80 std::map<url::Origin, DeviceIdToServicesMap> |
80 origin_to_device_id_to_services_map_; | 81 origin_to_device_id_to_services_map_; |
81 | 82 |
82 // Keep track of all device_ids in the map. | 83 // Keep track of all device_ids in the map. |
83 std::set<std::string> device_id_set_; | 84 std::set<std::string> device_id_set_; |
84 }; | 85 }; |
85 | 86 |
86 } // namespace content | 87 } // namespace content |
87 | 88 |
88 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_ | 89 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_ |
OLD | NEW |