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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp

Issue 2142813003: bluetooth: Avoid including non-blink mojo bindings in blink code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Add DCHECK for enum 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: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
index 5e6ebd9ff36da9cc9263eaf9441764977bb580ee..a88dff4023bbf68c97cec57a01bfebda60770cb4 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
@@ -48,11 +48,11 @@ public:
m_resolver->resolve(m_device->gatt());
}
- void onError(const WebBluetoothError& e) override
+ void onError(int32_t error /* Corresponds to WebBluetoothError in web_bluetooth.mojom */) override
{
if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
return;
- m_resolver->reject(BluetoothError::take(m_resolver, e));
+ m_resolver->reject(BluetoothError::take(m_resolver, error));
}
private:
Persistent<BluetoothDevice> m_device;
@@ -85,7 +85,7 @@ void BluetoothRemoteGATTServer::disconnect(ScriptState* scriptState)
// with a vector owning the services.
class GetPrimaryServicesCallback : public WebBluetoothGetPrimaryServicesCallbacks {
public:
- GetPrimaryServicesCallback(BluetoothDevice* device, mojom::WebBluetoothGATTQueryQuantity quantity, ScriptPromiseResolver* resolver)
+ GetPrimaryServicesCallback(BluetoothDevice* device, mojom::blink::WebBluetoothGATTQueryQuantity quantity, ScriptPromiseResolver* resolver)
: m_device(device)
, m_quantity(quantity)
, m_resolver(resolver) {}
@@ -95,7 +95,7 @@ public:
if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
return;
- if (m_quantity == mojom::WebBluetoothGATTQueryQuantity::SINGLE) {
+ if (m_quantity == mojom::blink::WebBluetoothGATTQueryQuantity::SINGLE) {
DCHECK_EQ(1u, webServices.size());
m_resolver->resolve(BluetoothRemoteGATTService::take(m_resolver, wrapUnique(webServices[0]), m_device));
return;
@@ -109,15 +109,15 @@ public:
m_resolver->resolve(services);
}
- void onError(const WebBluetoothError& e) override
+ void onError(int32_t error /* Corresponds to WebBluetoothError in web_bluetooth.mojom */) override
{
if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
return;
- m_resolver->reject(BluetoothError::take(m_resolver, e));
+ m_resolver->reject(BluetoothError::take(m_resolver, error));
}
private:
Persistent<BluetoothDevice> m_device;
- mojom::WebBluetoothGATTQueryQuantity m_quantity;
+ mojom::blink::WebBluetoothGATTQueryQuantity m_quantity;
Persistent<ScriptPromiseResolver> m_resolver;
};
@@ -127,7 +127,7 @@ ScriptPromise BluetoothRemoteGATTServer::getPrimaryService(ScriptState* scriptSt
if (exceptionState.hadException())
return exceptionState.reject(scriptState);
- return getPrimaryServicesImpl(scriptState, mojom::WebBluetoothGATTQueryQuantity::SINGLE, serviceUUID);
+ return getPrimaryServicesImpl(scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::SINGLE, serviceUUID);
}
ScriptPromise BluetoothRemoteGATTServer::getPrimaryServices(ScriptState* scriptState, const StringOrUnsignedLong& service, ExceptionState& exceptionState)
@@ -136,21 +136,21 @@ ScriptPromise BluetoothRemoteGATTServer::getPrimaryServices(ScriptState* scriptS
if (exceptionState.hadException())
return exceptionState.reject(scriptState);
- return getPrimaryServicesImpl(scriptState, mojom::WebBluetoothGATTQueryQuantity::MULTIPLE, serviceUUID);
+ return getPrimaryServicesImpl(scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::MULTIPLE, serviceUUID);
}
ScriptPromise BluetoothRemoteGATTServer::getPrimaryServices(ScriptState* scriptState, ExceptionState&)
{
- return getPrimaryServicesImpl(scriptState, mojom::WebBluetoothGATTQueryQuantity::MULTIPLE);
+ return getPrimaryServicesImpl(scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::MULTIPLE);
}
-ScriptPromise BluetoothRemoteGATTServer::getPrimaryServicesImpl(ScriptState* scriptState, mojom::WebBluetoothGATTQueryQuantity quantity, String servicesUUID)
+ScriptPromise BluetoothRemoteGATTServer::getPrimaryServicesImpl(ScriptState* scriptState, mojom::blink::WebBluetoothGATTQueryQuantity quantity, String servicesUUID)
{
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptState);
- webbluetooth->getPrimaryServices(device()->id(), quantity, servicesUUID, new GetPrimaryServicesCallback(device(), quantity, resolver));
+ webbluetooth->getPrimaryServices(device()->id(), static_cast<int32_t>(quantity), servicesUUID, new GetPrimaryServicesCallback(device(), quantity, resolver));
return promise;
}

Powered by Google App Engine
This is Rietveld 408576698