| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // |adapter| should be the adapter used to scan for Bluetooth devices. | 44 // |adapter| should be the adapter used to scan for Bluetooth devices. |
| 45 BluetoothDeviceChooserController( | 45 BluetoothDeviceChooserController( |
| 46 WebBluetoothServiceImpl* web_bluetooth_service_, | 46 WebBluetoothServiceImpl* web_bluetooth_service_, |
| 47 RenderFrameHost* render_frame_host, | 47 RenderFrameHost* render_frame_host, |
| 48 device::BluetoothAdapter* adapter); | 48 device::BluetoothAdapter* adapter); |
| 49 ~BluetoothDeviceChooserController(); | 49 ~BluetoothDeviceChooserController(); |
| 50 | 50 |
| 51 // This function performs the following checks before starting a discovery | 51 // This function performs the following checks before starting a discovery |
| 52 // session: | 52 // session: |
| 53 // - Validates filters in |request_device_options|. | 53 // - Validates filters in |request_device_options|. |
| 54 // - Removes any blacklisted UUIDs from | 54 // - Removes any blocklisted UUIDs from |
| 55 // |request_device_options.optinal_services|. | 55 // |request_device_options.optinal_services|. |
| 56 // - Checks if the request came from a cross-origin iframe. | 56 // - Checks if the request came from a cross-origin iframe. |
| 57 // - Checks if the request came from a unique origin. | 57 // - Checks if the request came from a unique origin. |
| 58 // - Checks if the adapter is present. | 58 // - Checks if the adapter is present. |
| 59 // - Checks if the Web Bluetooth API has been disabled. | 59 // - Checks if the Web Bluetooth API has been disabled. |
| 60 // - Checks if we are allowed to ask for scanning permission. | 60 // - Checks if we are allowed to ask for scanning permission. |
| 61 // If any of the previous checks failed then this function runs | 61 // If any of the previous checks failed then this function runs |
| 62 // |error_callback| with the corresponding error. Otherwise this function | 62 // |error_callback| with the corresponding error. Otherwise this function |
| 63 // populates the embedder provided BluetoothChooser with existing devices and | 63 // populates the embedder provided BluetoothChooser with existing devices and |
| 64 // starts a new discovery session. | 64 // starts a new discovery session. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Weak pointer factory for generating 'this' pointers that might live longer | 152 // Weak pointer factory for generating 'this' pointers that might live longer |
| 153 // than we do. | 153 // than we do. |
| 154 // Note: This should remain the last member so it'll be destroyed and | 154 // Note: This should remain the last member so it'll be destroyed and |
| 155 // invalidate its weak pointers before any other members are destroyed. | 155 // invalidate its weak pointers before any other members are destroyed. |
| 156 base::WeakPtrFactory<BluetoothDeviceChooserController> weak_ptr_factory_; | 156 base::WeakPtrFactory<BluetoothDeviceChooserController> weak_ptr_factory_; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 } // namespace content | 159 } // namespace content |
| 160 | 160 |
| 161 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ | 161 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ |
| OLD | NEW |