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

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

Issue 2565913002: [Onion Soup] Move WebBluetoothImpl from //content/renderer/bluetooth to Blink's bluetooth module (Closed)
Patch Set: renamed BluetoothUUID.typemap to Bluetooth.typemap Created 3 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "modules/bluetooth/BluetoothSupplement.h"
6
7 #include "core/dom/Document.h"
8
9 namespace blink {
10
11 const char* BluetoothSupplement::supplementName() {
12 return "BluetoothSupplement";
13 }
14
15 BluetoothSupplement::BluetoothSupplement(WebBluetooth* bluetooth)
16 : m_bluetooth(bluetooth) {}
17
18 void BluetoothSupplement::provideTo(LocalFrame& frame,
19 WebBluetooth* bluetooth) {
20 BluetoothSupplement* bluetoothSupplement = new BluetoothSupplement(bluetooth);
21 Supplement<LocalFrame>::provideTo(frame, supplementName(),
22 bluetoothSupplement);
23 };
24
25 WebBluetooth* BluetoothSupplement::from(LocalFrame* frame) {
26 BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(
27 Supplement<LocalFrame>::from(frame, supplementName()));
28
29 ASSERT(supplement);
30 ASSERT(supplement->m_bluetooth);
31
32 return supplement->m_bluetooth;
33 }
34
35 WebBluetooth* BluetoothSupplement::fromScriptState(ScriptState* scriptState) {
36 return fromExecutionContext(scriptState->getExecutionContext());
37 }
38
39 WebBluetooth* BluetoothSupplement::fromExecutionContext(
40 ExecutionContext* executionContext) {
41 if (!executionContext->isDocument()) {
42 return nullptr;
43 }
44 return BluetoothSupplement::from(
45 static_cast<Document*>(executionContext)->frame());
46 }
47
48 DEFINE_TRACE(BluetoothSupplement) {
49 Supplement<LocalFrame>::trace(visitor);
50 }
51
52 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.h ('k') | third_party/WebKit/Source/modules/bluetooth/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698