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

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

Issue 1948763003: Adding support for service scan on OS X (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup
Patch Set: Fixing comments Created 4 years, 7 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/BluetoothRemoteGATTServer.h" 5 #include "modules/bluetooth/BluetoothRemoteGATTServer.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"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/inspector/ConsoleMessage.h"
13 #include "modules/bluetooth/BluetoothError.h" 12 #include "modules/bluetooth/BluetoothError.h"
14 #include "modules/bluetooth/BluetoothRemoteGATTService.h" 13 #include "modules/bluetooth/BluetoothRemoteGATTService.h"
15 #include "modules/bluetooth/BluetoothSupplement.h" 14 #include "modules/bluetooth/BluetoothSupplement.h"
16 #include "modules/bluetooth/BluetoothUUID.h" 15 #include "modules/bluetooth/BluetoothUUID.h"
17 #include "public/platform/modules/bluetooth/WebBluetooth.h" 16 #include "public/platform/modules/bluetooth/WebBluetooth.h"
18 #include "wtf/OwnPtr.h" 17 #include "wtf/OwnPtr.h"
19 18
20 namespace blink { 19 namespace blink {
21 20
22 BluetoothRemoteGATTServer::BluetoothRemoteGATTServer(BluetoothDevice* device) 21 BluetoothRemoteGATTServer::BluetoothRemoteGATTServer(BluetoothDevice* device)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 73
75 void BluetoothRemoteGATTServer::disconnect(ScriptState* scriptState) 74 void BluetoothRemoteGATTServer::disconnect(ScriptState* scriptState)
76 { 75 {
77 m_connected = false; 76 m_connected = false;
78 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 77 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
79 webbluetooth->disconnect(device()->id()); 78 webbluetooth->disconnect(device()->id());
80 } 79 }
81 80
82 ScriptPromise BluetoothRemoteGATTServer::getPrimaryService(ScriptState* scriptSt ate, const StringOrUnsignedLong& service, ExceptionState& exceptionState) 81 ScriptPromise BluetoothRemoteGATTServer::getPrimaryService(ScriptState* scriptSt ate, const StringOrUnsignedLong& service, ExceptionState& exceptionState)
83 { 82 {
84 #if OS(MACOSX)
85 // TODO(jlebel): Remove when getPrimaryService is implemented.
86 return ScriptPromise::rejectWithDOMException(scriptState,
87 DOMException::create(NotSupportedError,
88 "getPrimaryService is not implemented yet. See https://goo.gl/J6ASzs "));
89 #endif // OS(MACOSX)
90
91 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 83 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
92 84
93 String serviceUUID = BluetoothUUID::getService(service, exceptionState); 85 String serviceUUID = BluetoothUUID::getService(service, exceptionState);
94 if (exceptionState.hadException()) 86 if (exceptionState.hadException())
95 return exceptionState.reject(scriptState); 87 return exceptionState.reject(scriptState);
96 88
97 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 89 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
98 ScriptPromise promise = resolver->promise(); 90 ScriptPromise promise = resolver->promise();
99 webbluetooth->getPrimaryService(device()->id(), serviceUUID, new CallbackPro miseAdapter<BluetoothRemoteGATTService, BluetoothError>(resolver)); 91 webbluetooth->getPrimaryService(device()->id(), serviceUUID, new CallbackPro miseAdapter<BluetoothRemoteGATTService, BluetoothError>(resolver));
100 92
101 return promise; 93 return promise;
102 } 94 }
103 95
104 } // namespace blink 96 } // 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