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

Unified Diff: content/browser/bluetooth/web_bluetooth_service_impl.cc

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/web_bluetooth_service_impl.cc
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.cc b/content/browser/bluetooth/web_bluetooth_service_impl.cc
index b4ee20fef4d531c53fa089eed3dac57c074edd7c..355e344b471a234ced30d2860c79d9a83d9e6dbb 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -15,7 +15,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
-#include "content/browser/bluetooth/bluetooth_adapter_factory_wrapper.h"
#include "content/browser/bluetooth/bluetooth_blacklist.h"
#include "content/browser/bluetooth/bluetooth_device_chooser_controller.h"
#include "content/browser/bluetooth/bluetooth_metrics.h"
@@ -25,8 +24,10 @@
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
+#include "device/bluetooth/bluetooth_adapter_factory_wrapper.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
+using device::BluetoothAdapterFactoryWrapper;
using device::BluetoothUUID;
namespace content {
@@ -314,8 +315,8 @@ void WebBluetoothServiceImpl::RequestDevice(
RecordRequestDeviceOptions(options);
if (!GetAdapter()) {
- if (GetBluetoothAdapterFactoryWrapper()->IsBluetoothAdapterAvailable()) {
- GetBluetoothAdapterFactoryWrapper()->AcquireAdapter(
+ if (BluetoothAdapterFactoryWrapper::Get().IsBluetoothAdapterAvailable()) {
+ BluetoothAdapterFactoryWrapper::Get().AcquireAdapter(
this, base::Bind(&WebBluetoothServiceImpl::RequestDeviceImpl,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(std::move(options)), callback));
@@ -678,9 +679,8 @@ void WebBluetoothServiceImpl::RequestDeviceImpl(
// they can't conflict.
device_chooser_controller_.reset();
- device_chooser_controller_.reset(new BluetoothDeviceChooserController(
- this, render_frame_host_, adapter,
- GetBluetoothAdapterFactoryWrapper()->GetScanDuration()));
+ device_chooser_controller_.reset(
+ new BluetoothDeviceChooserController(this, render_frame_host_, adapter));
device_chooser_controller_->GetDevice(
std::move(options),
@@ -970,15 +970,8 @@ RenderProcessHost* WebBluetoothServiceImpl::GetRenderProcessHost() {
return render_frame_host_->GetProcess();
}
-BluetoothAdapterFactoryWrapper*
-WebBluetoothServiceImpl::GetBluetoothAdapterFactoryWrapper() {
- RenderProcessHostImpl* render_process_host_impl =
- static_cast<RenderProcessHostImpl*>(GetRenderProcessHost());
- return render_process_host_impl->GetBluetoothAdapterFactoryWrapper();
-}
-
device::BluetoothAdapter* WebBluetoothServiceImpl::GetAdapter() {
- return GetBluetoothAdapterFactoryWrapper()->GetAdapter(this);
+ return BluetoothAdapterFactoryWrapper::Get().GetAdapter(this);
}
void WebBluetoothServiceImpl::CrashRendererAndClosePipe(
@@ -1000,7 +993,7 @@ void WebBluetoothServiceImpl::ClearState() {
new FrameConnectedBluetoothDevices(render_frame_host_));
allowed_devices_map_ = BluetoothAllowedDevicesMap();
device_chooser_controller_.reset();
- GetBluetoothAdapterFactoryWrapper()->ReleaseAdapter(this);
+ BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this);
}
} // namespace content
« no previous file with comments | « content/browser/bluetooth/web_bluetooth_service_impl.h ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698