blob: 53e68a28e3a79b74b03b304d2680a7727eef21df [file]
// 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/credentialmanager/NavigatorCredentials.h"
#include "core/dom/Document.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Navigator.h"
#include "modules/credentialmanager/CredentialsContainer.h"
namespace blink {
NavigatorCredentials::NavigatorCredentials(Navigator& navigator)
: Supplement<Navigator>(navigator) {}
NavigatorCredentials& NavigatorCredentials::from(Navigator& navigator) {
NavigatorCredentials* supplement = static_cast<NavigatorCredentials*>(
Supplement<Navigator>::from(navigator, supplementName()));
if (!supplement) {
supplement = new NavigatorCredentials(navigator);
provideTo(navigator, supplementName(), supplement);
}
return *supplement;
}
const char* NavigatorCredentials::supplementName() {
return "NavigatorCredentials";
}
CredentialsContainer* NavigatorCredentials::credentials(Navigator& navigator) {
return NavigatorCredentials::from(navigator).credentials();
}
CredentialsContainer* NavigatorCredentials::credentials() {
if (!m_credentialsContainer)
m_credentialsContainer = CredentialsContainer::create();
return m_credentialsContainer.get();
}
DEFINE_TRACE(NavigatorCredentials) {
visitor->trace(m_credentialsContainer);
Supplement<Navigator>::trace(visitor);
}
} // namespace blink