blob: 7d425055a14c210942e0b6e5d3b6719d4dcc898e [file] [log] [blame]
// 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 "modules/bluetooth/NavigatorBluetooth.h"
#include "core/frame/Navigator.h"
#include "modules/bluetooth/Bluetooth.h"
namespace blink {
NavigatorBluetooth& NavigatorBluetooth::From(Navigator& navigator) {
NavigatorBluetooth* supplement =
Supplement<Navigator>::From<NavigatorBluetooth>(navigator);
if (!supplement) {
supplement = new NavigatorBluetooth(navigator);
ProvideTo(navigator, supplement);
}
return *supplement;
}
Bluetooth* NavigatorBluetooth::bluetooth(Navigator& navigator) {
return NavigatorBluetooth::From(navigator).bluetooth();
}
Bluetooth* NavigatorBluetooth::bluetooth() {
if (!bluetooth_)
bluetooth_ = Bluetooth::Create();
return bluetooth_.Get();
}
void NavigatorBluetooth::Trace(blink::Visitor* visitor) {
visitor->Trace(bluetooth_);
Supplement<Navigator>::Trace(visitor);
}
NavigatorBluetooth::NavigatorBluetooth(Navigator& navigator)
: Supplement<Navigator>(navigator) {}
// static
const char NavigatorBluetooth::kSupplementName[] = "NavigatorBluetooth";
} // namespace blink