Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: components/autofill/content/renderer/password_form_conversion_utils.cc

Issue 1292693004: [Password Manager] Autofill forms with field name and id attributes missing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Vadym's inputs. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/autofill/content/renderer/password_form_conversion_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 void PopulateSyntheticFormFromWebForm(const WebFormElement& web_form, 133 void PopulateSyntheticFormFromWebForm(const WebFormElement& web_form,
134 SyntheticForm* synthetic_form) { 134 SyntheticForm* synthetic_form) {
135 synthetic_form->control_elements = ExtractAutofillableElementsInForm( 135 synthetic_form->control_elements = ExtractAutofillableElementsInForm(
136 web_form); 136 web_form);
137 synthetic_form->action = web_form.action(); 137 synthetic_form->action = web_form.action();
138 synthetic_form->document = web_form.document(); 138 synthetic_form->document = web_form.document();
139 } 139 }
140 140
141 // Checks in a case-insensitive way if the autocomplete attribute for the given
142 // |element| is present and has the specified |value_in_lowercase|.
143 bool HasAutocompleteAttributeValue(const WebInputElement& element,
144 const char* value_in_lowercase) {
145 return base::LowerCaseEqualsASCII(
146 base::StringPiece16(element.getAttribute("autocomplete")),
147 value_in_lowercase);
148 }
149
150 // Helper to determine which password is the main (current) one, and which is 141 // Helper to determine which password is the main (current) one, and which is
151 // the new password (e.g., on a sign-up or change password form), if any. 142 // the new password (e.g., on a sign-up or change password form), if any.
152 bool LocateSpecificPasswords(std::vector<WebInputElement> passwords, 143 bool LocateSpecificPasswords(std::vector<WebInputElement> passwords,
153 WebInputElement* current_password, 144 WebInputElement* current_password,
154 WebInputElement* new_password) { 145 WebInputElement* new_password) {
155 DCHECK(current_password && current_password->isNull()); 146 DCHECK(current_password && current_password->isNull());
156 DCHECK(new_password && new_password->isNull()); 147 DCHECK(new_password && new_password->isNull());
157 148
158 // First, look for elements marked with either autocomplete='current-password' 149 // First, look for elements marked with either autocomplete='current-password'
159 // or 'new-password' -- if we find any, take the hint, and treat the first of 150 // or 'new-password' -- if we find any, take the hint, and treat the first of
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 if (!GetPasswordForm(synthetic_form, password_form.get(), 649 if (!GetPasswordForm(synthetic_form, password_form.get(),
659 nonscript_modified_values, form_predictions)) 650 nonscript_modified_values, form_predictions))
660 return scoped_ptr<PasswordForm>(); 651 return scoped_ptr<PasswordForm>();
661 652
662 // No actual action on the form, so use the the origin as the action. 653 // No actual action on the form, so use the the origin as the action.
663 password_form->action = password_form->origin; 654 password_form->action = password_form->origin;
664 655
665 return password_form.Pass(); 656 return password_form.Pass();
666 } 657 }
667 658
659 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element,
660 const char* value_in_lowercase) {
661 return base::LowerCaseEqualsASCII(
662 base::StringPiece16(element.getAttribute("autocomplete")),
663 value_in_lowercase);
664 }
665
668 } // namespace autofill 666 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/password_form_conversion_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698