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

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

Issue 2071853002: Revert of bluetooth: mac: Initial BluetoothRemoteGattCharacteristicMac implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@servicescan_cleanup
Patch Set: Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/BluetoothRemoteGATTService.h" 5 #include "modules/bluetooth/BluetoothRemoteGATTService.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/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return; 64 return;
65 m_resolver->reject(BluetoothError::take(m_resolver, e)); 65 m_resolver->reject(BluetoothError::take(m_resolver, e));
66 } 66 }
67 private: 67 private:
68 Persistent<ScriptPromiseResolver> m_resolver; 68 Persistent<ScriptPromiseResolver> m_resolver;
69 mojom::WebBluetoothGATTQueryQuantity m_quantity; 69 mojom::WebBluetoothGATTQueryQuantity m_quantity;
70 }; 70 };
71 71
72 ScriptPromise BluetoothRemoteGATTService::getCharacteristic(ScriptState* scriptS tate, const StringOrUnsignedLong& characteristic, ExceptionState& exceptionState ) 72 ScriptPromise BluetoothRemoteGATTService::getCharacteristic(ScriptState* scriptS tate, const StringOrUnsignedLong& characteristic, ExceptionState& exceptionState )
73 { 73 {
74 #if OS(MACOSX)
75 // TODO(jlebel): Remove when getCharacteristic is implemented.
76 return ScriptPromise::rejectWithDOMException(scriptState,
77 DOMException::create(NotSupportedError,
78 "getCharacteristic is not implemented yet. See https://goo.gl/J6ASzs "));
79 #endif // OS(MACOSX)
80
74 String characteristicUUID = BluetoothUUID::getCharacteristic(characteristic, exceptionState); 81 String characteristicUUID = BluetoothUUID::getCharacteristic(characteristic, exceptionState);
75 if (exceptionState.hadException()) 82 if (exceptionState.hadException())
76 return exceptionState.reject(scriptState); 83 return exceptionState.reject(scriptState);
77 84
78 return getCharacteristicsImpl(scriptState, mojom::WebBluetoothGATTQueryQuant ity::SINGLE, characteristicUUID); 85 return getCharacteristicsImpl(scriptState, mojom::WebBluetoothGATTQueryQuant ity::SINGLE, characteristicUUID);
79 } 86 }
80 87
81 ScriptPromise BluetoothRemoteGATTService::getCharacteristics(ScriptState* script State, const StringOrUnsignedLong& characteristic, ExceptionState& exceptionStat e) 88 ScriptPromise BluetoothRemoteGATTService::getCharacteristics(ScriptState* script State, const StringOrUnsignedLong& characteristic, ExceptionState& exceptionStat e)
82 { 89 {
83 String characteristicUUID = BluetoothUUID::getCharacteristic(characteristic, exceptionState); 90 String characteristicUUID = BluetoothUUID::getCharacteristic(characteristic, exceptionState);
84 if (exceptionState.hadException()) 91 if (exceptionState.hadException())
85 return exceptionState.reject(scriptState); 92 return exceptionState.reject(scriptState);
86 93
87 return getCharacteristicsImpl(scriptState, mojom::WebBluetoothGATTQueryQuant ity::MULTIPLE, characteristicUUID); 94 return getCharacteristicsImpl(scriptState, mojom::WebBluetoothGATTQueryQuant ity::MULTIPLE, characteristicUUID);
88 } 95 }
89 96
90 ScriptPromise BluetoothRemoteGATTService::getCharacteristics(ScriptState* script State, ExceptionState&) 97 ScriptPromise BluetoothRemoteGATTService::getCharacteristics(ScriptState* script State, ExceptionState&)
91 { 98 {
92 return getCharacteristicsImpl(scriptState, mojom::WebBluetoothGATTQueryQuant ity::MULTIPLE); 99 return getCharacteristicsImpl(scriptState, mojom::WebBluetoothGATTQueryQuant ity::MULTIPLE);
93 } 100 }
94 101
95 ScriptPromise BluetoothRemoteGATTService::getCharacteristicsImpl(ScriptState* sc riptState, mojom::WebBluetoothGATTQueryQuantity quantity, String characteristics UUID) 102 ScriptPromise BluetoothRemoteGATTService::getCharacteristicsImpl(ScriptState* sc riptState, mojom::WebBluetoothGATTQueryQuantity quantity, String characteristics UUID)
96 { 103 {
104 #if OS(MACOSX)
105 // TODO(jlebel): Remove when getCharacteristics is implemented.
106 return ScriptPromise::rejectWithDOMException(scriptState,
107 DOMException::create(NotSupportedError,
108 "getCharacteristics is not implemented yet. See https://goo.gl/J6ASz s"));
109 #endif // OS(MACOSX)
110
97 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 111 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
98 ScriptPromise promise = resolver->promise(); 112 ScriptPromise promise = resolver->promise();
99 113
100 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 114 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
101 webbluetooth->getCharacteristics(m_webService->serviceInstanceID, quantity, characteristicsUUID, new GetCharacteristicsCallback(quantity, resolver)); 115 webbluetooth->getCharacteristics(m_webService->serviceInstanceID, quantity, characteristicsUUID, new GetCharacteristicsCallback(quantity, resolver));
102 116
103 return promise; 117 return promise;
104 } 118 }
105 119
106 } // namespace blink 120 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698