| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/credentialmanager/PasswordCredential.h" | 6 #include "modules/credentialmanager/PasswordCredential.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "core/html/DOMFormData.h" | 9 #include "core/html/DOMFormData.h" |
| 10 #include "platform/credentialmanager/PlatformPasswordCredential.h" | 10 #include "platform/credentialmanager/PlatformPasswordCredential.h" |
| 11 #include "public/platform/WebCredential.h" | 11 #include "public/platform/WebCredential.h" |
| 12 #include "public/platform/WebPasswordCredential.h" | 12 #include "public/platform/WebPasswordCredential.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswor
dCredential) | 16 PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswor
dCredential) |
| 17 { | 17 { |
| 18 return new PasswordCredential(webPasswordCredential); | 18 return new PasswordCredential(webPasswordCredential); |
| 19 } | 19 } |
| 20 | 20 |
| 21 PasswordCredential* PasswordCredential::create(const String& id, const String& p
assword, const String& name, const String& avatar, ExceptionState& exceptionStat
e) | 21 PasswordCredential* PasswordCredential::create(const String& id, const String& p
assword, const String& name, const String& icon, ExceptionState& exceptionState) |
| 22 { | 22 { |
| 23 KURL avatarURL = parseStringAsURL(avatar, exceptionState); | 23 KURL iconURL = parseStringAsURL(icon, exceptionState); |
| 24 if (exceptionState.hadException()) | 24 if (exceptionState.hadException()) |
| 25 return nullptr; | 25 return nullptr; |
| 26 return new PasswordCredential(id, password, name, avatarURL); | 26 return new PasswordCredential(id, password, name, iconURL); |
| 27 } | 27 } |
| 28 | 28 |
| 29 PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredent
ial) | 29 PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredent
ial) |
| 30 : Credential(webPasswordCredential->platformCredential()) | 30 : Credential(webPasswordCredential->platformCredential()) |
| 31 { | 31 { |
| 32 } | 32 } |
| 33 | 33 |
| 34 PasswordCredential::PasswordCredential(const String& id, const String& password,
const String& name, const KURL& avatar) | 34 PasswordCredential::PasswordCredential(const String& id, const String& password,
const String& name, const KURL& icon) |
| 35 : Credential(PlatformPasswordCredential::create(id, password, name, avatar)) | 35 : Credential(PlatformPasswordCredential::create(id, password, name, icon)) |
| 36 , m_formData(DOMFormData::create()) | 36 , m_formData(DOMFormData::create()) |
| 37 { | 37 { |
| 38 m_formData->append("username", id); | 38 m_formData->append("username", id); |
| 39 m_formData->append("password", password); | 39 m_formData->append("password", password); |
| 40 } | 40 } |
| 41 | 41 |
| 42 const String& PasswordCredential::password() const | 42 const String& PasswordCredential::password() const |
| 43 { | 43 { |
| 44 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())-
>password(); | 44 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())-
>password(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 DEFINE_TRACE(PasswordCredential) | 47 DEFINE_TRACE(PasswordCredential) |
| 48 { | 48 { |
| 49 visitor->trace(m_formData); | 49 visitor->trace(m_formData); |
| 50 Credential::trace(visitor); | 50 Credential::trace(visitor); |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace blink | 53 } // namespace blink |
| OLD | NEW |