| 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) | 233 #if OS(MACOSX) || OS(ANDROID) |
| 234 // TODO(jlebel): Remove when stopNotifications is implemented. | 234 // TODO(jlebel): Remove when stopNotifications is implemented. |
| 235 // TODO(scheib): Remove when stopNotifications is implemented. |
| 235 return ScriptPromise::rejectWithDOMException(scriptState, | 236 return ScriptPromise::rejectWithDOMException(scriptState, |
| 236 DOMException::create(NotSupportedError, | 237 DOMException::create(NotSupportedError, |
| 237 "stopNotifications is not implemented yet. See https://goo.gl/J6ASzs
")); | 238 "stopNotifications is not implemented yet. See https://goo.gl/J6ASzs
")); |
| 238 #endif // OS(MACOSX) | 239 #endif // OS(MACOSX) || OS(ANDROID) |
| 239 | 240 |
| 240 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat
e); | 241 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat
e); |
| 241 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 242 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 242 ScriptPromise promise = resolver->promise(); | 243 ScriptPromise promise = resolver->promise(); |
| 243 webbluetooth->stopNotifications(m_webCharacteristic->characteristicInstanceI
D, new NotificationsCallback(this, resolver)); | 244 webbluetooth->stopNotifications(m_webCharacteristic->characteristicInstanceI
D, new NotificationsCallback(this, resolver)); |
| 244 return promise; | 245 return promise; |
| 245 } | 246 } |
| 246 | 247 |
| 247 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) | 248 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) |
| 248 { | 249 { |
| 249 visitor->trace(m_service); | 250 visitor->trace(m_service); |
| 250 visitor->trace(m_properties); | 251 visitor->trace(m_properties); |
| 251 visitor->trace(m_value); | 252 visitor->trace(m_value); |
| 252 EventTargetWithInlineData::trace(visitor); | 253 EventTargetWithInlineData::trace(visitor); |
| 253 ActiveDOMObject::trace(visitor); | 254 ActiveDOMObject::trace(visitor); |
| 254 } | 255 } |
| 255 | 256 |
| 256 } // namespace blink | 257 } // namespace blink |
| OLD | NEW |