OLD | NEW |
(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 |
OLD | NEW |