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

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

Issue 2716263002: DO NOT SUBMIT. Renderer side of Bluetooth Test API in blink C++ (Closed)
Patch Set: Created 3 years, 9 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 2017 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/BluetoothFakeBluetooth.h"
6
7 #include "modules/bluetooth/Bluetooth.h"
8 #include "modules/bluetooth/FakeBluetooth.h"
9
10 namespace blink {
11
12 BluetoothFakeBluetooth& BluetoothFakeBluetooth::from(Bluetooth& bluetooth) {
13 BluetoothFakeBluetooth* supplement = static_cast<BluetoothFakeBluetooth*>(
14 Supplement<Bluetooth>::from(bluetooth, supplementName()));
15
16 if (!supplement) {
17 supplement = new BluetoothFakeBluetooth(bluetooth);
18 provideTo(bluetooth, supplementName(), supplement);
19 }
20 return *supplement;
21 }
22
23 FakeBluetooth* BluetoothFakeBluetooth::test(Bluetooth& bluetooth) {
24 return BluetoothFakeBluetooth::from(bluetooth).test();
25 }
26
27 FakeBluetooth* BluetoothFakeBluetooth::test() {
28 if (!m_test)
29 m_test = FakeBluetooth::create();
30 return m_test.get();
31 }
32
33 DEFINE_TRACE(BluetoothFakeBluetooth) {
34 visitor->trace(m_test);
35 Supplement<Bluetooth>::trace(visitor);
36 }
37
38 BluetoothFakeBluetooth::BluetoothFakeBluetooth(Bluetooth& bluetooth)
39 : Supplement<Bluetooth>(bluetooth) {
40 }
41
42 const char* BluetoothFakeBluetooth::supplementName() {
43 return "BluetoothFakeBluetooth";
44 }
45
46 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698