| Index: Source/modules/credentialmanager/PasswordCredential.cpp
|
| diff --git a/Source/modules/credentialmanager/PasswordCredential.cpp b/Source/modules/credentialmanager/PasswordCredential.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6df7e7c542c3e1420178f626c4aed77c9aef75b8
|
| --- /dev/null
|
| +++ b/Source/modules/credentialmanager/PasswordCredential.cpp
|
| @@ -0,0 +1,53 @@
|
| +// 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/credentialmanager/PasswordCredential.h"
|
| +
|
| +#include "bindings/core/v8/ExceptionState.h"
|
| +#include "core/html/DOMFormData.h"
|
| +#include "platform/credentialmanager/PlatformPasswordCredential.h"
|
| +#include "public/platform/WebCredential.h"
|
| +#include "public/platform/WebPasswordCredential.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswordCredential)
|
| +{
|
| + return new PasswordCredential(webPasswordCredential);
|
| +}
|
| +
|
| +PasswordCredential* PasswordCredential::create(const String& id, const String& password, const String& name, const String& avatar, ExceptionState& exceptionState)
|
| +{
|
| + KURL avatarURL = parseStringAsURL(avatar, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return nullptr;
|
| + return new PasswordCredential(id, password, name, avatarURL);
|
| +}
|
| +
|
| +PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredential)
|
| + : Credential(webPasswordCredential->platformCredential())
|
| +{
|
| +}
|
| +
|
| +PasswordCredential::PasswordCredential(const String& id, const String& password, const String& name, const KURL& avatar)
|
| + : Credential(PlatformPasswordCredential::create(id, password, name, avatar))
|
| + , m_formData(DOMFormData::create())
|
| +{
|
| + m_formData->append("username", id);
|
| + m_formData->append("password", password);
|
| +}
|
| +
|
| +const String& PasswordCredential::password() const
|
| +{
|
| + return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())->password();
|
| +}
|
| +
|
| +DEFINE_TRACE(PasswordCredential)
|
| +{
|
| + visitor->trace(m_formData);
|
| + Credential::trace(visitor);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|