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

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

Issue 1059393002: Remove --respect-autocomplete-off-autofill flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix last 3 tests Created 5 years, 8 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
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/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 return true; 180 return true;
181 } 181 }
182 182
183 void FindPredictedUsernameElement( 183 void FindPredictedUsernameElement(
184 const WebFormElement& form, 184 const WebFormElement& form,
185 const std::map<autofill::FormData, autofill::FormFieldData>& 185 const std::map<autofill::FormData, autofill::FormFieldData>&
186 form_predictions, 186 form_predictions,
187 WebVector<WebFormControlElement>* control_elements, 187 WebVector<WebFormControlElement>* control_elements,
188 WebInputElement* predicted_username_element) { 188 WebInputElement* predicted_username_element) {
189 FormData form_data; 189 FormData form_data;
190 if (!WebFormElementToFormData(form, WebFormControlElement(), REQUIRE_NONE, 190 if (!WebFormElementToFormData(form, WebFormControlElement(), EXTRACT_NONE,
191 EXTRACT_NONE, &form_data, nullptr)) 191 &form_data, nullptr)) {
192 return; 192 return;
193 }
193 194
194 // Prediction forms are not user submitted, but |form| can be user submitted. 195 // Prediction forms are not user submitted, but |form| can be user submitted.
195 // We don't care about this flag for finding predictions, so set it to false. 196 // We don't care about this flag for finding predictions, so set it to false.
196 form_data.user_submitted = false; 197 form_data.user_submitted = false;
197 auto predictions_iterator = form_predictions.find(form_data); 198 auto predictions_iterator = form_predictions.find(form_data);
198 if (predictions_iterator == form_predictions.end()) 199 if (predictions_iterator == form_predictions.end())
199 return; 200 return;
200 201
201 std::vector<blink::WebFormControlElement> autofillable_elements = 202 std::vector<blink::WebFormControlElement> autofillable_elements =
202 ExtractAutofillableElementsFromSet(*control_elements, REQUIRE_NONE); 203 ExtractAutofillableElementsFromSet(*control_elements);
203 DCHECK_EQ(autofillable_elements.size(), form_data.fields.size()); 204 DCHECK_EQ(autofillable_elements.size(), form_data.fields.size());
204 205
205 const autofill::FormFieldData& username_field = predictions_iterator->second; 206 const autofill::FormFieldData& username_field = predictions_iterator->second;
206 autofill::FormFieldData form_field; 207 autofill::FormFieldData form_field;
207 for (size_t i = 0; i < autofillable_elements.size(); ++i) { 208 for (size_t i = 0; i < autofillable_elements.size(); ++i) {
208 if (form_data.fields[i].SameFieldAs(username_field)) { 209 if (form_data.fields[i].SameFieldAs(username_field)) {
209 WebInputElement* input_element = 210 WebInputElement* input_element =
210 toWebInputElement(&autofillable_elements[i]); 211 toWebInputElement(&autofillable_elements[i]);
211 if (input_element) { 212 if (input_element) {
212 *predicted_username_element = *input_element; 213 *predicted_username_element = *input_element;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 435
435 scoped_ptr<PasswordForm> password_form(new PasswordForm()); 436 scoped_ptr<PasswordForm> password_form(new PasswordForm());
436 GetPasswordForm(web_form, password_form.get(), nonscript_modified_values, 437 GetPasswordForm(web_form, password_form.get(), nonscript_modified_values,
437 form_predictions); 438 form_predictions);
438 439
439 if (!password_form->action.is_valid()) 440 if (!password_form->action.is_valid())
440 return scoped_ptr<PasswordForm>(); 441 return scoped_ptr<PasswordForm>();
441 442
442 WebFormElementToFormData(web_form, 443 WebFormElementToFormData(web_form,
443 blink::WebFormControlElement(), 444 blink::WebFormControlElement(),
444 REQUIRE_NONE,
445 EXTRACT_NONE, 445 EXTRACT_NONE,
446 &password_form->form_data, 446 &password_form->form_data,
447 NULL /* FormFieldData */); 447 NULL /* FormFieldData */);
448 448
449 return password_form.Pass(); 449 return password_form.Pass();
450 } 450 }
451 451
452 } // namespace autofill 452 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698