| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "modules/credentialmanager/LocalCredential.h" | |
| 7 | |
| 8 #include "bindings/core/v8/ExceptionState.h" | |
| 9 #include "core/html/DOMFormData.h" | |
| 10 #include "platform/credentialmanager/PlatformLocalCredential.h" | |
| 11 #include "public/platform/WebCredential.h" | |
| 12 #include "public/platform/WebLocalCredential.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 LocalCredential* LocalCredential::create(WebLocalCredential* webLocalCredential) | |
| 17 { | |
| 18 return new LocalCredential(webLocalCredential); | |
| 19 } | |
| 20 | |
| 21 LocalCredential* LocalCredential::create(const String& id, const String& passwor
d, const String& name, const String& avatar, ExceptionState& exceptionState) | |
| 22 { | |
| 23 KURL avatarURL = parseStringAsURL(avatar, exceptionState); | |
| 24 if (exceptionState.hadException()) | |
| 25 return nullptr; | |
| 26 return new LocalCredential(id, password, name, avatarURL); | |
| 27 } | |
| 28 | |
| 29 LocalCredential::LocalCredential(WebLocalCredential* webLocalCredential) | |
| 30 : Credential(webLocalCredential->platformCredential()) | |
| 31 { | |
| 32 } | |
| 33 | |
| 34 LocalCredential::LocalCredential(const String& id, const String& password, const
String& name, const KURL& avatar) | |
| 35 : Credential(PlatformLocalCredential::create(id, password, name, avatar)) | |
| 36 , m_formData(DOMFormData::create()) | |
| 37 { | |
| 38 m_formData->append("username", id); | |
| 39 m_formData->append("password", password); | |
| 40 } | |
| 41 | |
| 42 const String& LocalCredential::password() const | |
| 43 { | |
| 44 return static_cast<PlatformLocalCredential*>(m_platformCredential.get())->pa
ssword(); | |
| 45 } | |
| 46 | |
| 47 DEFINE_TRACE(LocalCredential) | |
| 48 { | |
| 49 visitor->trace(m_formData); | |
| 50 Credential::trace(visitor); | |
| 51 } | |
| 52 | |
| 53 } // namespace blink | |
| OLD | NEW |