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