| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_device_chooser_controller.h" | 5 #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unordered_set> | 9 #include <unordered_set> |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (!base::StartsWith(device.GetName().value(), filter->name_prefix.get(), | 103 if (!base::StartsWith(device.GetName().value(), filter->name_prefix.get(), |
| 104 base::CompareCase::SENSITIVE)) | 104 base::CompareCase::SENSITIVE)) |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 | 107 |
| 108 if (!filter->services.is_null()) { | 108 if (!filter->services.is_null()) { |
| 109 const auto& device_uuid_list = device.GetUUIDs(); | 109 const auto& device_uuid_list = device.GetUUIDs(); |
| 110 const std::unordered_set<BluetoothUUID, device::BluetoothUUIDHash> | 110 const std::unordered_set<BluetoothUUID, device::BluetoothUUIDHash> |
| 111 device_uuids(device_uuid_list.begin(), device_uuid_list.end()); | 111 device_uuids(device_uuid_list.begin(), device_uuid_list.end()); |
| 112 for (const base::Optional<BluetoothUUID>& service : filter->services) { | 112 for (const base::Optional<BluetoothUUID>& service : filter->services) { |
| 113 if (!ContainsKey(device_uuids, service.value())) { | 113 if (!base::ContainsKey(device_uuids, service.value())) { |
| 114 return false; | 114 return false; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 return true; | 119 return true; |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool MatchesFilters( | 122 bool MatchesFilters( |
| 123 const device::BluetoothDevice& device, | 123 const device::BluetoothDevice& device, |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 487 |
| 488 void BluetoothDeviceChooserController::PostErrorCallback( | 488 void BluetoothDeviceChooserController::PostErrorCallback( |
| 489 blink::mojom::WebBluetoothError error) { | 489 blink::mojom::WebBluetoothError error) { |
| 490 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 490 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 491 FROM_HERE, base::Bind(error_callback_, error))) { | 491 FROM_HERE, base::Bind(error_callback_, error))) { |
| 492 LOG(WARNING) << "No TaskRunner."; | 492 LOG(WARNING) << "No TaskRunner."; |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 | 495 |
| 496 } // namespace content | 496 } // namespace content |
| OLD | NEW |