| 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 #ifndef PasswordCredential_h | 5 #ifndef PasswordCredential_h |
| 6 #define PasswordCredential_h | 6 #define PasswordCredential_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "bindings/core/v8/SerializedScriptValue.h" | 9 #include "bindings/core/v8/SerializedScriptValue.h" |
| 10 #include "bindings/modules/v8/UnionTypesModules.h" |
| 10 #include "modules/credentialmanager/Credential.h" | 11 #include "modules/credentialmanager/Credential.h" |
| 11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "platform/network/EncodedFormData.h" |
| 12 #include "platform/weborigin/KURL.h" | 14 #include "platform/weborigin/KURL.h" |
| 13 | 15 |
| 14 namespace blink { | 16 namespace blink { |
| 15 | 17 |
| 16 class FormData; | 18 class FormData; |
| 17 class FormDataOptions; | 19 class FormDataOptions; |
| 18 class PasswordCredentialData; | 20 class PasswordCredentialData; |
| 19 class WebPasswordCredential; | 21 class WebPasswordCredential; |
| 20 | 22 |
| 23 using CredentialPostBodyType = FormDataOrURLSearchParams; |
| 24 |
| 21 class PasswordCredential final : public Credential { | 25 class PasswordCredential final : public Credential { |
| 22 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
| 23 public: | 27 public: |
| 24 static PasswordCredential* create(const PasswordCredentialData&, ExceptionSt
ate&); | 28 static PasswordCredential* create(const PasswordCredentialData&, ExceptionSt
ate&); |
| 25 static PasswordCredential* create(WebPasswordCredential*); | 29 static PasswordCredential* create(WebPasswordCredential*); |
| 26 | 30 |
| 27 // PasswordCredential.idl | 31 // PasswordCredential.idl |
| 28 FormData* toFormData(ScriptState*, const FormDataOptions&); | 32 void setIdName(const String& name) { m_idName = name; } |
| 33 const String& idName() const { return m_idName; } |
| 29 | 34 |
| 35 void setPasswordName(const String& name) { m_passwordName = name; } |
| 36 const String& passwordName() const { return m_passwordName; } |
| 37 |
| 38 void setAdditionalData(const CredentialPostBodyType& data) { m_additionalDat
a = data; } |
| 39 void additionalData(CredentialPostBodyType& out) const { out = m_additionalD
ata; } |
| 40 |
| 41 // Internal methods |
| 42 PassRefPtr<EncodedFormData> encodeFormData() const; |
| 43 const String& password() const; |
| 30 DECLARE_VIRTUAL_TRACE(); | 44 DECLARE_VIRTUAL_TRACE(); |
| 31 | 45 |
| 32 private: | 46 private: |
| 33 PasswordCredential(WebPasswordCredential*); | 47 PasswordCredential(WebPasswordCredential*); |
| 34 PasswordCredential(const String& id, const String& password, const String& n
ame, const KURL& icon); | 48 PasswordCredential(const String& id, const String& password, const String& n
ame, const KURL& icon); |
| 35 | 49 |
| 36 const String& password() const; | 50 String m_idName; |
| 51 String m_passwordName; |
| 52 CredentialPostBodyType m_additionalData; |
| 37 }; | 53 }; |
| 38 | 54 |
| 39 } // namespace blink | 55 } // namespace blink |
| 40 | 56 |
| 41 #endif // PasswordCredential_h | 57 #endif // PasswordCredential_h |
| OLD | NEW |