Chromium Code Reviews| Index: Source/modules/bluetooth/NavigatorBluetooth.cpp |
| diff --git a/Source/modules/bluetooth/NavigatorBluetooth.cpp b/Source/modules/bluetooth/NavigatorBluetooth.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6492a2e3bb9e4582d23b4ae0c59120567f43df16 |
| --- /dev/null |
| +++ b/Source/modules/bluetooth/NavigatorBluetooth.cpp |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "modules/bluetooth/NavigatorBluetooth.h" |
| + |
| +#include "core/frame/Navigator.h" |
| +#include "modules/bluetooth/Bluetooth.h" |
| + |
| +namespace blink { |
| + |
| +NavigatorBluetooth& NavigatorBluetooth::from(Navigator& navigator) |
| +{ |
| + NavigatorBluetooth* supplement = static_cast<NavigatorBluetooth*>(WillBeHeapSupplement<Navigator>::from(navigator, supplementName())); |
| + if (!supplement) { |
| + supplement = new NavigatorBluetooth(); |
| + provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); |
| + } |
| + return *supplement; |
| +} |
| + |
| +Bluetooth* NavigatorBluetooth::bluetooth(Navigator& navigator) |
| +{ |
| + return NavigatorBluetooth::from(navigator).bluetooth(); |
| +} |
| + |
| +Bluetooth* NavigatorBluetooth::bluetooth() const |
| +{ |
| + if (!m_bluetooth) |
| + m_bluetooth = Bluetooth::create(); |
|
scheib
2014/10/08 00:06:10
Compile error: ../../third_party/WebKit/Source/mod
tkent
2014/10/08 00:23:41
NavigatorBluetooth::bluetooth() is a const functio
scheib
2014/10/08 05:49:31
Done.
|
| + return m_bluetooth.get(); |
| +} |
| + |
| +void NavigatorBluetooth::trace(Visitor* visitor) |
| +{ |
| + visitor->trace(m_bluetooth); |
| + WillBeHeapSupplement<Navigator>::trace(visitor); |
| +} |
| + |
| +NavigatorBluetooth::NavigatorBluetooth() |
| +{ |
| +} |
| + |
| +DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NavigatorBluetooth); |
| + |
| +const char* NavigatorBluetooth::supplementName() |
| +{ |
| + return "NavigatorBluetooth"; |
| +} |
| + |
| +} // namespace blink |