| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/content/renderer/password_form_conversion_utils.h" | 5 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "components/autofill/content/renderer/form_autofill_util.h" | 8 #include "components/autofill/content/renderer/form_autofill_util.h" |
| 9 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| 11 #include "third_party/WebKit/public/web/WebDocument.h" | 11 #include "third_party/WebKit/public/web/WebDocument.h" |
| 12 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 12 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
| 13 #include "third_party/WebKit/public/web/WebInputElement.h" | 13 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 14 | 14 |
| 15 using blink::WebDocument; | 15 using blink::WebDocument; |
| 16 using blink::WebFormControlElement; | 16 using blink::WebFormControlElement; |
| 17 using blink::WebFormElement; | 17 using blink::WebFormElement; |
| 18 using blink::WebInputElement; | 18 using blink::WebInputElement; |
| 19 using blink::WebString; | 19 using blink::WebString; |
| 20 using blink::WebVector; | 20 using blink::WebVector; |
| 21 | 21 |
| 22 namespace autofill { | 22 namespace autofill { |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Checks in a case-insensitive way if the autocomplete attribute for the given | 25 // Checks in a case-insensitive way if the autocomplete attribute for the given |
| 26 // |element| is present and has the specified |value_in_lowercase|. | 26 // |element| is present and has the specified |value_in_lowercase|. |
| 27 bool HasAutocompleteAttributeValue(const WebInputElement& element, | 27 bool HasAutocompleteAttributeValue(const WebInputElement& element, |
| 28 const char* value_in_lowercase) { | 28 const char* value_in_lowercase) { |
| 29 return LowerCaseEqualsASCII(element.getAttribute("autocomplete"), | 29 return base::LowerCaseEqualsASCII( |
| 30 value_in_lowercase); | 30 base::string16(element.getAttribute("autocomplete")), |
| 31 value_in_lowercase); |
| 31 } | 32 } |
| 32 | 33 |
| 33 // Helper to determine which password is the main (current) one, and which is | 34 // Helper to determine which password is the main (current) one, and which is |
| 34 // the new password (e.g., on a sign-up or change password form), if any. | 35 // the new password (e.g., on a sign-up or change password form), if any. |
| 35 bool LocateSpecificPasswords(std::vector<WebInputElement> passwords, | 36 bool LocateSpecificPasswords(std::vector<WebInputElement> passwords, |
| 36 WebInputElement* current_password, | 37 WebInputElement* current_password, |
| 37 WebInputElement* new_password) { | 38 WebInputElement* new_password) { |
| 38 DCHECK(current_password && current_password->isNull()); | 39 DCHECK(current_password && current_password->isNull()); |
| 39 DCHECK(new_password && new_password->isNull()); | 40 DCHECK(new_password && new_password->isNull()); |
| 40 | 41 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 blink::WebFormControlElement(), | 260 blink::WebFormControlElement(), |
| 260 REQUIRE_NONE, | 261 REQUIRE_NONE, |
| 261 EXTRACT_NONE, | 262 EXTRACT_NONE, |
| 262 &password_form->form_data, | 263 &password_form->form_data, |
| 263 NULL /* FormFieldData */); | 264 NULL /* FormFieldData */); |
| 264 | 265 |
| 265 return password_form.Pass(); | 266 return password_form.Pass(); |
| 266 } | 267 } |
| 267 | 268 |
| 268 } // namespace autofill | 269 } // namespace autofill |
| OLD | NEW |