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

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

Issue 2762023002: work in progress 2
Patch Set: Created 3 years, 9 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 5adce0eeaf41874eec81f3bf15c7b6341768c44f..b7206d82c42d5baa1354a10f78ef39ee3479bfda 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -28,6 +28,8 @@
#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor.h"
+#include "base/logging.h"
+
using device::BluetoothAdapterFactoryWrapper;
using device::BluetoothUUID;
@@ -212,6 +214,19 @@ void WebBluetoothServiceImpl::AdapterPoweredChanged(
}
}
+void WebBluetoothServiceImpl::AdapterDiscoveringChanged(
+ device::BluetoothAdapter* adapter,
+ bool discovering) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ LOG(ERROR) << "[DJKim] WebBluetoothServiceImpl::AdapterDiscoveringChanged";
+ if (device_chooser_controller_.get()) {
+ LOG(ERROR) << "[DJKim] WebBluetoothServiceImpl::AdapterDiscoveringChanged >> AdapterDiscoveringChanged";
+ device_chooser_controller_->AdapterDiscoveringChanged(discovering);
+ } else {
+ LOG(ERROR) << "[DJKim] WebBluetoothServiceImpl::AdapterDiscoveringChanged >> device_chooser_controller_ is NULL";
+ }
+}
+
void WebBluetoothServiceImpl::DeviceAdded(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -1134,4 +1149,35 @@ void WebBluetoothServiceImpl::ClearState() {
BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this);
}
+bool WebBluetoothServiceImpl::IsDiscoverySessionActive() {
+ if (device_chooser_controller_.get())
+ return device_chooser_controller_->IsDiscoverySessionActive();
+
+ return false;
+}
+
+void WebBluetoothServiceImpl::SimulateRequestDevice() {
+ //requestDevice(blink::mojom::WebBluetoothRequestDeviceOptionsPtr(), nullptr);
+ // In order to convert the arguments from service names and aliases to just
+ // UUIDs, do the following substeps:
+ // auto deviceOptions = mojom::blink::WebBluetoothRequestDeviceOptions::New();
+ //convertRequestDeviceOptions(options, deviceOptions, exceptionState);
+
+ //if (exceptionState.hadException())
+ // return exceptionState.reject(scriptState);
+
+ // Subsequent steps are handled in the browser process.
+ // ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(nullptr);
+ //ScriptPromise promise = resolver->promise();
+ // TestCallback callback;
+
+
+ //RequestDevice(
+ // std::move(deviceOptions),
+ // callback);
+ //convertToBaseCallback(WTF::bind(&Bluetooth::RequestDeviceCallback,
+ // wrapPersistent(this),
+ // wrapPersistent(resolver))));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698