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

Side by Side Diff: content/browser/bluetooth/bluetooth_allowed_devices_map.cc

Issue 2304213002: Show device connection and paired status in chooser on Mac (Closed)
Patch Set: added code to handle text identation Created 4 years, 3 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
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 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" 5 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 CHECK(origin_to_device_id_to_address_map_.erase(origin)); 77 CHECK(origin_to_device_id_to_address_map_.erase(origin));
78 CHECK(origin_to_device_id_to_services_map_.erase(origin)); 78 CHECK(origin_to_device_id_to_services_map_.erase(origin));
79 } 79 }
80 80
81 // 3. Remove from set of ids. 81 // 3. Remove from set of ids.
82 CHECK(device_id_set_.erase(device_id)); 82 CHECK(device_id_set_.erase(device_id));
83 } 83 }
84 84
85 const WebBluetoothDeviceId* BluetoothAllowedDevicesMap::GetDeviceId( 85 const WebBluetoothDeviceId* BluetoothAllowedDevicesMap::GetDeviceId(
86 const url::Origin& origin, 86 const url::Origin& origin,
87 const std::string& device_address) { 87 const std::string& device_address) const {
88 auto address_map_iter = origin_to_device_address_to_id_map_.find(origin); 88 auto address_map_iter = origin_to_device_address_to_id_map_.find(origin);
89 if (address_map_iter == origin_to_device_address_to_id_map_.end()) { 89 if (address_map_iter == origin_to_device_address_to_id_map_.end()) {
90 return nullptr; 90 return nullptr;
91 } 91 }
92 92
93 const auto& device_address_to_id_map = address_map_iter->second; 93 const auto& device_address_to_id_map = address_map_iter->second;
94 94
95 auto id_iter = device_address_to_id_map.find(device_address); 95 auto id_iter = device_address_to_id_map.find(device_address);
96 if (id_iter == device_address_to_id_map.end()) { 96 if (id_iter == device_address_to_id_map.end()) {
97 return nullptr; 97 return nullptr;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 for (const base::Optional<BluetoothUUID>& uuid : filter->services) { 154 for (const base::Optional<BluetoothUUID>& uuid : filter->services) {
155 unionOfServices->insert(uuid.value()); 155 unionOfServices->insert(uuid.value());
156 } 156 }
157 } 157 }
158 for (const base::Optional<BluetoothUUID>& uuid : options->optional_services) { 158 for (const base::Optional<BluetoothUUID>& uuid : options->optional_services) {
159 unionOfServices->insert(uuid.value()); 159 unionOfServices->insert(uuid.value());
160 } 160 }
161 } 161 }
162 162
163 } // namespace content 163 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698