Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: content/browser/bluetooth/bluetooth_device_chooser_controller.h

Issue 2059543002: bluetooth: Move FactoryWrapper to device and expose a function for testing in chooser controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Remove code from client interface Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/bluetooth_device_chooser_controller.h
diff --git a/content/browser/bluetooth/bluetooth_device_chooser_controller.h b/content/browser/bluetooth/bluetooth_device_chooser_controller.h
index dfa87248677a034cba22bcd981d6709c0d59f9ed..5d81fd25f477486c10fdea9ae2efa3ffbef3b70d 100644
--- a/content/browser/bluetooth/bluetooth_device_chooser_controller.h
+++ b/content/browser/bluetooth/bluetooth_device_chooser_controller.h
@@ -10,6 +10,7 @@
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
+#include "content/common/content_export.h"
#include "content/public/browser/bluetooth_chooser.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom.h"
@@ -29,7 +30,7 @@ class WebBluetoothServiceImpl;
// Class that interacts with a chooser and starts a bluetooth discovery session.
// This class needs to be re-instantiated for each call to GetDevice(). Calling
// GetDevice() twice for the same instance will DCHECK.
-class BluetoothDeviceChooserController final {
+class CONTENT_EXPORT BluetoothDeviceChooserController final {
public:
typedef base::Callback<void(blink::mojom::WebBluetoothRequestDeviceOptionsPtr,
const std::string& device_address)>
@@ -41,12 +42,10 @@ class BluetoothDeviceChooserController final {
// |render_frame_host| should be the RenderFrameHost that owns the
// |web_bluetooth_service_|.
// |adapter| should be the adapter used to scan for Bluetooth devices.
- // |scan_duration| is how long will a discovery session be active.
BluetoothDeviceChooserController(
WebBluetoothServiceImpl* web_bluetooth_service_,
RenderFrameHost* render_frame_host,
- device::BluetoothAdapter* adapter,
- base::TimeDelta scan_duration);
+ device::BluetoothAdapter* adapter);
~BluetoothDeviceChooserController();
// This function performs the following checks before starting a discovery
@@ -79,6 +78,10 @@ class BluetoothDeviceChooserController final {
// that the adapter changed states.
void AdapterPoweredChanged(bool powered);
+ // After this method is called any new instance of
+ // BluetoothDeviceChooserController will have a scan duration of 0.
+ static void SetTestScanDurationForTesting();
+
private:
// Populates the chooser with the devices that are already in the adapter.
void PopulateFoundDevices();
@@ -107,6 +110,9 @@ class BluetoothDeviceChooserController final {
// Helper function to asynchronously run error_callback_.
void PostErrorCallback(blink::mojom::WebBluetoothError error);
+ // If true all new instances of this class will have a scan duration of 0.
+ static bool use_test_scan_duration_;
+
// The adapter used to get existing devices and start a discovery session.
device::BluetoothAdapter* adapter_;
// The WebBluetoothServiceImpl that owns this instance.

Powered by Google App Engine
This is Rietveld 408576698