| 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 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const ErrorCallback& error_callback); | 71 const ErrorCallback& error_callback); |
| 72 | 72 |
| 73 // Adds a device to the chooser. Should only be called after GetDevice and | 73 // Adds a device to the chooser. Should only be called after GetDevice and |
| 74 // before either of the callbacks are run. | 74 // before either of the callbacks are run. |
| 75 void AddFilteredDevice(const device::BluetoothDevice& device); | 75 void AddFilteredDevice(const device::BluetoothDevice& device); |
| 76 | 76 |
| 77 // Stops the current discovery session and notifies the chooser | 77 // Stops the current discovery session and notifies the chooser |
| 78 // that the adapter changed states. | 78 // that the adapter changed states. |
| 79 void AdapterPoweredChanged(bool powered); | 79 void AdapterPoweredChanged(bool powered); |
| 80 | 80 |
| 81 // Received Signal Strength Indicator (RSSI) is a measurement of the power |
| 82 // present in a received radio signal. |
| 83 static int CalculateSignalStrengthLevel(int8_t rssi); |
| 84 |
| 81 // After this method is called any new instance of | 85 // After this method is called any new instance of |
| 82 // BluetoothDeviceChooserController will have a scan duration of 0. | 86 // BluetoothDeviceChooserController will have a scan duration of 0. |
| 83 static void SetTestScanDurationForTesting(); | 87 static void SetTestScanDurationForTesting(); |
| 84 | 88 |
| 85 private: | 89 private: |
| 86 // Populates the chooser with the GATT connected devices. | 90 // Populates the chooser with the GATT connected devices. |
| 87 void PopulateConnectedDevices(); | 91 void PopulateConnectedDevices(); |
| 88 | 92 |
| 89 // Notifies the chooser that discovery is starting and starts a discovery | 93 // Notifies the chooser that discovery is starting and starts a discovery |
| 90 // session. | 94 // session. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Weak pointer factory for generating 'this' pointers that might live longer | 149 // Weak pointer factory for generating 'this' pointers that might live longer |
| 146 // than we do. | 150 // than we do. |
| 147 // Note: This should remain the last member so it'll be destroyed and | 151 // Note: This should remain the last member so it'll be destroyed and |
| 148 // invalidate its weak pointers before any other members are destroyed. | 152 // invalidate its weak pointers before any other members are destroyed. |
| 149 base::WeakPtrFactory<BluetoothDeviceChooserController> weak_ptr_factory_; | 153 base::WeakPtrFactory<BluetoothDeviceChooserController> weak_ptr_factory_; |
| 150 }; | 154 }; |
| 151 | 155 |
| 152 } // namespace content | 156 } // namespace content |
| 153 | 157 |
| 154 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ | 158 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ |
| OLD | NEW |