| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const int k60thPercentileRSSI = -55; | 72 const int k60thPercentileRSSI = -55; |
| 73 const int k80thPercentileRSSI = -47; | 73 const int k80thPercentileRSSI = -47; |
| 74 | 74 |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 namespace content { | 77 namespace content { |
| 78 | 78 |
| 79 bool BluetoothDeviceChooserController::use_test_scan_duration_ = false; | 79 bool BluetoothDeviceChooserController::use_test_scan_duration_ = false; |
| 80 | 80 |
| 81 namespace { | 81 namespace { |
| 82 // Max length of device name in filter. A name coming from an adv packet | 82 // Max length of device name in filter. Bluetooth 5.0 3.C.3.2.2.3 states that |
| 83 // is max 29 bytes (adv packet max size 31 bytes - 2 byte length field), | 83 // the maximum device name length is 248 bytes (UTF-8 encoded). |
| 84 // but the name can also be acquired via gap.device_name, so it is limited | 84 constexpr size_t kMaxLengthForDeviceName = 248; |
| 85 // to the max EIR packet size of 240 bytes. See Core Spec 5.0, vol 3, C, 8.1.2. | |
| 86 constexpr size_t kMaxLengthForDeviceName = 240; | |
| 87 | 85 |
| 88 // The duration of a Bluetooth Scan in seconds. | 86 // The duration of a Bluetooth Scan in seconds. |
| 89 constexpr int kScanDuration = 60; | 87 constexpr int kScanDuration = 60; |
| 90 constexpr int kTestScanDuration = 0; | 88 constexpr int kTestScanDuration = 0; |
| 91 | 89 |
| 92 void LogRequestDeviceOptions( | 90 void LogRequestDeviceOptions( |
| 93 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { | 91 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { |
| 94 DVLOG(1) << "requestDevice called with the following filters: "; | 92 DVLOG(1) << "requestDevice called with the following filters: "; |
| 95 DVLOG(1) << "acceptAllDevices: " << options->accept_all_devices; | 93 DVLOG(1) << "acceptAllDevices: " << options->accept_all_devices; |
| 96 | 94 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 617 |
| 620 void BluetoothDeviceChooserController::PostErrorCallback( | 618 void BluetoothDeviceChooserController::PostErrorCallback( |
| 621 blink::mojom::WebBluetoothResult error) { | 619 blink::mojom::WebBluetoothResult error) { |
| 622 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 620 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 623 FROM_HERE, base::Bind(error_callback_, error))) { | 621 FROM_HERE, base::Bind(error_callback_, error))) { |
| 624 LOG(WARNING) << "No TaskRunner."; | 622 LOG(WARNING) << "No TaskRunner."; |
| 625 } | 623 } |
| 626 } | 624 } |
| 627 | 625 |
| 628 } // namespace content | 626 } // namespace content |
| OLD | NEW |