OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" | 5 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" |
6 | 6 |
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "core/dom/DOMDataView.h" | 10 #include "core/dom/DOMDataView.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 { | 223 { |
224 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat
e); | 224 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat
e); |
225 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 225 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
226 ScriptPromise promise = resolver->promise(); | 226 ScriptPromise promise = resolver->promise(); |
227 webbluetooth->startNotifications(m_webCharacteristic->characteristicInstance
ID, new NotificationsCallback(this, resolver)); | 227 webbluetooth->startNotifications(m_webCharacteristic->characteristicInstance
ID, new NotificationsCallback(this, resolver)); |
228 return promise; | 228 return promise; |
229 } | 229 } |
230 | 230 |
231 ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState*
scriptState) | 231 ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState*
scriptState) |
232 { | 232 { |
233 #if OS(MACOSX) || OS(ANDROID) | 233 #if OS(MACOSX) |
234 // TODO(jlebel): Remove when stopNotifications is implemented. | 234 // TODO(jlebel): Remove when stopNotifications is implemented. |
235 // TODO(scheib): Remove when stopNotifications is implemented. | |
236 return ScriptPromise::rejectWithDOMException(scriptState, | 235 return ScriptPromise::rejectWithDOMException(scriptState, |
237 DOMException::create(NotSupportedError, | 236 DOMException::create(NotSupportedError, |
238 "stopNotifications is not implemented yet. See https://goo.gl/J6ASzs
")); | 237 "stopNotifications is not implemented yet. See https://goo.gl/J6ASzs
")); |
239 #endif // OS(MACOSX) || OS(ANDROID) | 238 #endif // OS(MACOSX) |
240 | 239 |
241 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat
e); | 240 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat
e); |
242 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 241 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
243 ScriptPromise promise = resolver->promise(); | 242 ScriptPromise promise = resolver->promise(); |
244 webbluetooth->stopNotifications(m_webCharacteristic->characteristicInstanceI
D, new NotificationsCallback(this, resolver)); | 243 webbluetooth->stopNotifications(m_webCharacteristic->characteristicInstanceI
D, new NotificationsCallback(this, resolver)); |
245 return promise; | 244 return promise; |
246 } | 245 } |
247 | 246 |
248 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) | 247 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) |
249 { | 248 { |
250 visitor->trace(m_service); | 249 visitor->trace(m_service); |
251 visitor->trace(m_properties); | 250 visitor->trace(m_properties); |
252 visitor->trace(m_value); | 251 visitor->trace(m_value); |
253 EventTargetWithInlineData::trace(visitor); | 252 EventTargetWithInlineData::trace(visitor); |
254 ActiveDOMObject::trace(visitor); | 253 ActiveDOMObject::trace(visitor); |
255 } | 254 } |
256 | 255 |
257 } // namespace blink | 256 } // namespace blink |
OLD | NEW |