| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   99  |   99  | 
|  100   if (!filter->name_prefix.is_null() && filter->name_prefix.size()) { |  100   if (!filter->name_prefix.is_null() && filter->name_prefix.size()) { | 
|  101     if (!device.GetName()) |  101     if (!device.GetName()) | 
|  102       return false; |  102       return false; | 
|  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 device::BluetoothDevice::UUIDSet& device_uuids = device.GetUUIDs(); | 
|  110     const std::unordered_set<BluetoothUUID, device::BluetoothUUIDHash> |  | 
|  111         device_uuids(device_uuid_list.begin(), device_uuid_list.end()); |  | 
|  112     for (const base::Optional<BluetoothUUID>& service : filter->services) { |  110     for (const base::Optional<BluetoothUUID>& service : filter->services) { | 
|  113       if (!base::ContainsKey(device_uuids, service.value())) { |  111       if (!base::ContainsKey(device_uuids, service.value())) { | 
|  114         return false; |  112         return false; | 
|  115       } |  113       } | 
|  116     } |  114     } | 
|  117   } |  115   } | 
|  118  |  116  | 
|  119   return true; |  117   return true; | 
|  120 } |  118 } | 
|  121  |  119  | 
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  487  |  485  | 
|  488 void BluetoothDeviceChooserController::PostErrorCallback( |  486 void BluetoothDeviceChooserController::PostErrorCallback( | 
|  489     blink::mojom::WebBluetoothError error) { |  487     blink::mojom::WebBluetoothError error) { | 
|  490   if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |  488   if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 
|  491           FROM_HERE, base::Bind(error_callback_, error))) { |  489           FROM_HERE, base::Bind(error_callback_, error))) { | 
|  492     LOG(WARNING) << "No TaskRunner."; |  490     LOG(WARNING) << "No TaskRunner."; | 
|  493   } |  491   } | 
|  494 } |  492 } | 
|  495  |  493  | 
|  496 }  // namespace content |  494 }  // namespace content | 
| OLD | NEW |