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