| 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/PasswordCredential.h" |
| 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "core/html/DOMFormData.h" |
| 10 #include "platform/credentialmanager/PlatformPasswordCredential.h" |
| 11 #include "public/platform/WebCredential.h" |
| 12 #include "public/platform/WebPasswordCredential.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswor
dCredential) |
| 17 { |
| 18 return new PasswordCredential(webPasswordCredential); |
| 19 } |
| 20 |
| 21 PasswordCredential* PasswordCredential::create(const String& id, const String& p
assword, const String& name, const String& avatar, ExceptionState& exceptionStat
e) |
| 22 { |
| 23 KURL avatarURL = parseStringAsURL(avatar, exceptionState); |
| 24 if (exceptionState.hadException()) |
| 25 return nullptr; |
| 26 return new PasswordCredential(id, password, name, avatarURL); |
| 27 } |
| 28 |
| 29 PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredent
ial) |
| 30 : Credential(webPasswordCredential->platformCredential()) |
| 31 { |
| 32 } |
| 33 |
| 34 PasswordCredential::PasswordCredential(const String& id, const String& password,
const String& name, const KURL& avatar) |
| 35 : Credential(PlatformPasswordCredential::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& PasswordCredential::password() const |
| 43 { |
| 44 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())-
>password(); |
| 45 } |
| 46 |
| 47 DEFINE_TRACE(PasswordCredential) |
| 48 { |
| 49 visitor->trace(m_formData); |
| 50 Credential::trace(visitor); |
| 51 } |
| 52 |
| 53 } // namespace blink |
| OLD | NEW |