| 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/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/DOMDataView.h" | 9 #include "core/dom/DOMDataView.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 361 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 362 ScriptPromise promise = resolver->promise(); | 362 ScriptPromise promise = resolver->promise(); |
| 363 webbluetooth->startNotifications( | 363 webbluetooth->startNotifications( |
| 364 m_webCharacteristic->characteristicInstanceID, | 364 m_webCharacteristic->characteristicInstanceID, |
| 365 new NotificationsCallback(this, resolver)); | 365 new NotificationsCallback(this, resolver)); |
| 366 return promise; | 366 return promise; |
| 367 } | 367 } |
| 368 | 368 |
| 369 ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications( | 369 ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications( |
| 370 ScriptState* scriptState) { | 370 ScriptState* scriptState) { |
| 371 #if OS(MACOSX) | |
| 372 // TODO(jlebel): Remove when stopNotifications is implemented. | |
| 373 return ScriptPromise::rejectWithDOMException( | |
| 374 scriptState, DOMException::create(NotSupportedError, | |
| 375 "stopNotifications is not implemented " | |
| 376 "yet. See https://goo.gl/J6ASzs")); | |
| 377 #endif // OS(MACOSX) | |
| 378 | |
| 379 if (!gatt()->connected()) { | 371 if (!gatt()->connected()) { |
| 380 return ScriptPromise::rejectWithDOMException( | 372 return ScriptPromise::rejectWithDOMException( |
| 381 scriptState, | 373 scriptState, |
| 382 DOMException::create(NetworkError, kGATTServerNotConnected)); | 374 DOMException::create(NetworkError, kGATTServerNotConnected)); |
| 383 } | 375 } |
| 384 | 376 |
| 385 if (!gatt()->device()->isValidCharacteristic( | 377 if (!gatt()->device()->isValidCharacteristic( |
| 386 m_webCharacteristic->characteristicInstanceID)) { | 378 m_webCharacteristic->characteristicInstanceID)) { |
| 387 return ScriptPromise::rejectWithDOMException( | 379 return ScriptPromise::rejectWithDOMException( |
| 388 scriptState, | 380 scriptState, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 400 | 392 |
| 401 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) { | 393 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) { |
| 402 visitor->trace(m_service); | 394 visitor->trace(m_service); |
| 403 visitor->trace(m_properties); | 395 visitor->trace(m_properties); |
| 404 visitor->trace(m_value); | 396 visitor->trace(m_value); |
| 405 EventTargetWithInlineData::trace(visitor); | 397 EventTargetWithInlineData::trace(visitor); |
| 406 ActiveDOMObject::trace(visitor); | 398 ActiveDOMObject::trace(visitor); |
| 407 } | 399 } |
| 408 | 400 |
| 409 } // namespace blink | 401 } // namespace blink |
| OLD | NEW |