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
3 // found in the LICENSE file.
6 #include "modules/bluetooth/NavigatorBluetooth.h"
8 #include "core/frame/Navigator.h"
9 #include "modules/bluetooth/Bluetooth.h"
13 NavigatorBluetooth& NavigatorBluetooth::from(Navigator& navigator)
15 NavigatorBluetooth* supplement = static_cast<NavigatorBluetooth*>(WillBeHeapSupplement<Navigator>::from(navigator, supplementName()));
17 supplement = new NavigatorBluetooth();
18 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement));
23 Bluetooth* NavigatorBluetooth::bluetooth(Navigator& navigator)
25 return NavigatorBluetooth::from(navigator).bluetooth();
28 Bluetooth* NavigatorBluetooth::bluetooth()
31 m_bluetooth = Bluetooth::create();
32 return m_bluetooth.get();
35 void NavigatorBluetooth::trace(Visitor* visitor)
37 visitor->trace(m_bluetooth);
38 WillBeHeapSupplement<Navigator>::trace(visitor);
41 NavigatorBluetooth::NavigatorBluetooth()
45 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NavigatorBluetooth);
47 const char* NavigatorBluetooth::supplementName()
49 return "NavigatorBluetooth";