OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "modules/bluetooth/NavigatorBluetooth.h" | 6 #include "modules/bluetooth/NavigatorBluetooth.h" |
7 | 7 |
8 #include "core/frame/Navigator.h" | 8 #include "core/frame/Navigator.h" |
9 #include "modules/bluetooth/Bluetooth.h" | 9 #include "modules/bluetooth/Bluetooth.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 NavigatorBluetooth& NavigatorBluetooth::from(Navigator& navigator) | 13 NavigatorBluetooth& NavigatorBluetooth::from(Navigator& navigator) |
14 { | 14 { |
15 NavigatorBluetooth* supplement = static_cast<NavigatorBluetooth*>(WillBeHeap
Supplement<Navigator>::from(navigator, supplementName())); | 15 NavigatorBluetooth* supplement = static_cast<NavigatorBluetooth*>(HeapSupple
ment<Navigator>::from(navigator, supplementName())); |
16 if (!supplement) { | 16 if (!supplement) { |
17 supplement = new NavigatorBluetooth(); | 17 supplement = new NavigatorBluetooth(); |
18 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | 18 provideTo(navigator, supplementName(), supplement); |
19 } | 19 } |
20 return *supplement; | 20 return *supplement; |
21 } | 21 } |
22 | 22 |
23 Bluetooth* NavigatorBluetooth::bluetooth(Navigator& navigator) | 23 Bluetooth* NavigatorBluetooth::bluetooth(Navigator& navigator) |
24 { | 24 { |
25 return NavigatorBluetooth::from(navigator).bluetooth(); | 25 return NavigatorBluetooth::from(navigator).bluetooth(); |
26 } | 26 } |
27 | 27 |
28 Bluetooth* NavigatorBluetooth::bluetooth() | 28 Bluetooth* NavigatorBluetooth::bluetooth() |
29 { | 29 { |
30 if (!m_bluetooth) | 30 if (!m_bluetooth) |
31 m_bluetooth = Bluetooth::create(); | 31 m_bluetooth = Bluetooth::create(); |
32 return m_bluetooth.get(); | 32 return m_bluetooth.get(); |
33 } | 33 } |
34 | 34 |
35 DEFINE_TRACE(NavigatorBluetooth) | 35 DEFINE_TRACE(NavigatorBluetooth) |
36 { | 36 { |
37 visitor->trace(m_bluetooth); | 37 visitor->trace(m_bluetooth); |
38 WillBeHeapSupplement<Navigator>::trace(visitor); | 38 HeapSupplement<Navigator>::trace(visitor); |
39 } | 39 } |
40 | 40 |
41 NavigatorBluetooth::NavigatorBluetooth() | 41 NavigatorBluetooth::NavigatorBluetooth() |
42 { | 42 { |
43 } | 43 } |
44 | 44 |
45 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NavigatorBluetooth); | |
46 | |
47 const char* NavigatorBluetooth::supplementName() | 45 const char* NavigatorBluetooth::supplementName() |
48 { | 46 { |
49 return "NavigatorBluetooth"; | 47 return "NavigatorBluetooth"; |
50 } | 48 } |
51 | 49 |
52 } // namespace blink | 50 } // namespace blink |
OLD | NEW |