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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp

Issue 2051333004: Implement BluetoothGattNotifySession::Stop on Android, 2nd attempt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Giovanni's review comments Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 { 199 {
200 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 200 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
201 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 201 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
202 ScriptPromise promise = resolver->promise(); 202 ScriptPromise promise = resolver->promise();
203 webbluetooth->startNotifications(m_webCharacteristic->characteristicInstance ID, new CallbackPromiseAdapter<void, BluetoothError>(resolver)); 203 webbluetooth->startNotifications(m_webCharacteristic->characteristicInstance ID, new CallbackPromiseAdapter<void, BluetoothError>(resolver));
204 return promise; 204 return promise;
205 } 205 }
206 206
207 ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState* scriptState) 207 ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState* scriptState)
208 { 208 {
209 #if OS(MACOSX) || OS(ANDROID) 209 #if OS(MACOSX)
210 // TODO(jlebel): Remove when stopNotifications is implemented. 210 // TODO(jlebel): Remove when stopNotifications is implemented.
211 // TODO(scheib): Remove when stopNotifications is implemented.
212 return ScriptPromise::rejectWithDOMException(scriptState, 211 return ScriptPromise::rejectWithDOMException(scriptState,
213 DOMException::create(NotSupportedError, 212 DOMException::create(NotSupportedError,
214 "stopNotifications is not implemented yet. See https://goo.gl/J6ASzs ")); 213 "stopNotifications is not implemented yet. See https://goo.gl/J6ASzs "));
215 #endif // OS(MACOSX) || OS(ANDROID) 214 #endif // OS(MACOSX)
216 215
217 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 216 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
218 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 217 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
219 ScriptPromise promise = resolver->promise(); 218 ScriptPromise promise = resolver->promise();
220 webbluetooth->stopNotifications(m_webCharacteristic->characteristicInstanceI D, new CallbackPromiseAdapter<void, BluetoothError>(resolver)); 219 webbluetooth->stopNotifications(m_webCharacteristic->characteristicInstanceI D, new CallbackPromiseAdapter<void, BluetoothError>(resolver));
221 return promise; 220 return promise;
222 } 221 }
223 222
224 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) 223 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic)
225 { 224 {
226 visitor->trace(m_service); 225 visitor->trace(m_service);
227 visitor->trace(m_properties); 226 visitor->trace(m_properties);
228 visitor->trace(m_value); 227 visitor->trace(m_value);
229 EventTargetWithInlineData::trace(visitor); 228 EventTargetWithInlineData::trace(visitor);
230 ActiveDOMObject::trace(visitor); 229 ActiveDOMObject::trace(visitor);
231 } 230 }
232 231
233 } // namespace blink 232 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698