| 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 "modules/credentialmanager/PasswordCredential.h" | 5 #include "modules/credentialmanager/PasswordCredential.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "core/HTMLNames.h" | 9 #include "core/HTMLNames.h" |
| 10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
| 11 #include "core/dom/URLSearchParams.h" | 11 #include "core/dom/URLSearchParams.h" |
| 12 #include "core/html/FormAssociatedElement.h" | |
| 13 #include "core/html/FormData.h" | 12 #include "core/html/FormData.h" |
| 14 #include "core/html/HTMLFormElement.h" | 13 #include "core/html/HTMLFormElement.h" |
| 14 #include "core/html/ListedElement.h" |
| 15 #include "modules/credentialmanager/FormDataOptions.h" | 15 #include "modules/credentialmanager/FormDataOptions.h" |
| 16 #include "modules/credentialmanager/PasswordCredentialData.h" | 16 #include "modules/credentialmanager/PasswordCredentialData.h" |
| 17 #include "platform/credentialmanager/PlatformPasswordCredential.h" | 17 #include "platform/credentialmanager/PlatformPasswordCredential.h" |
| 18 #include "platform/weborigin/SecurityOrigin.h" | 18 #include "platform/weborigin/SecurityOrigin.h" |
| 19 #include "public/platform/WebCredential.h" | 19 #include "public/platform/WebCredential.h" |
| 20 #include "public/platform/WebPasswordCredential.h" | 20 #include "public/platform/WebPasswordCredential.h" |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 | 23 |
| 24 PasswordCredential* PasswordCredential::create( | 24 PasswordCredential* PasswordCredential::create( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 // https://w3c.github.io/webappsec-credential-management/#passwordcredential-for
m-constructor | 49 // https://w3c.github.io/webappsec-credential-management/#passwordcredential-for
m-constructor |
| 50 PasswordCredential* PasswordCredential::create(HTMLFormElement* form, | 50 PasswordCredential* PasswordCredential::create(HTMLFormElement* form, |
| 51 ExceptionState& exceptionState) { | 51 ExceptionState& exceptionState) { |
| 52 // Extract data from the form, then use the extracted |formData| object's | 52 // Extract data from the form, then use the extracted |formData| object's |
| 53 // value to populate |data|. | 53 // value to populate |data|. |
| 54 FormData* formData = FormData::create(form); | 54 FormData* formData = FormData::create(form); |
| 55 PasswordCredentialData data; | 55 PasswordCredentialData data; |
| 56 | 56 |
| 57 AtomicString idName; | 57 AtomicString idName; |
| 58 AtomicString passwordName; | 58 AtomicString passwordName; |
| 59 for (FormAssociatedElement* element : form->associatedElements()) { | 59 for (ListedElement* element : form->listedElements()) { |
| 60 // If |element| isn't a "submittable element" with string data, then it | 60 // If |element| isn't a "submittable element" with string data, then it |
| 61 // won't have a matching value in |formData|, and we can safely skip it. | 61 // won't have a matching value in |formData|, and we can safely skip it. |
| 62 FileOrUSVString result; | 62 FileOrUSVString result; |
| 63 formData->get(element->name(), result); | 63 formData->get(element->name(), result); |
| 64 if (!result.isUSVString()) | 64 if (!result.isUSVString()) |
| 65 continue; | 65 continue; |
| 66 | 66 |
| 67 Vector<String> autofillTokens; | 67 Vector<String> autofillTokens; |
| 68 toHTMLElement(element) | 68 toHTMLElement(element) |
| 69 ->fastGetAttribute(HTMLNames::autocompleteAttr) | 69 ->fastGetAttribute(HTMLNames::autocompleteAttr) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get()) | 179 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get()) |
| 180 ->password(); | 180 ->password(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 DEFINE_TRACE(PasswordCredential) { | 183 DEFINE_TRACE(PasswordCredential) { |
| 184 SiteBoundCredential::trace(visitor); | 184 SiteBoundCredential::trace(visitor); |
| 185 visitor->trace(m_additionalData); | 185 visitor->trace(m_additionalData); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace blink | 188 } // namespace blink |
| OLD | NEW |