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

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

Issue 1408423003: [Password Manager] Ignore autofilling invisible password fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Vaclav'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_autofill_agent.cc ('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 <string> 7 #include <string>
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 kAutocompleteCurrentPassword) || 357 kAutocompleteCurrentPassword) ||
358 HasAutocompleteAttributeValue(*input_element, kAutocompleteNewPassword); 358 HasAutocompleteAttributeValue(*input_element, kAutocompleteNewPassword);
359 359
360 // If the password field is readonly, the page is likely using a virtual 360 // If the password field is readonly, the page is likely using a virtual
361 // keyboard and bypassing the password field value (see 361 // keyboard and bypassing the password field value (see
362 // http://crbug.com/475488). There is nothing Chrome can do to fill 362 // http://crbug.com/475488). There is nothing Chrome can do to fill
363 // passwords for now. Continue processing in case when the password field 363 // passwords for now. Continue processing in case when the password field
364 // was made readonly by JavaScript before submission. We can do this by 364 // was made readonly by JavaScript before submission. We can do this by
365 // checking whether password element was updated not from JavaScript. 365 // checking whether password element was updated not from JavaScript.
366 if (input_element->isPasswordField() && 366 if (input_element->isPasswordField() &&
367 form_util::IsWebNodeVisible(*input_element) &&
367 (!input_element->isReadOnly() || 368 (!input_element->isReadOnly() ||
368 (nonscript_modified_values && 369 (nonscript_modified_values &&
369 nonscript_modified_values->find(*input_element) != 370 nonscript_modified_values->find(*input_element) !=
370 nonscript_modified_values->end()) || 371 nonscript_modified_values->end()) ||
371 password_marked_by_autocomplete_attribute)) { 372 password_marked_by_autocomplete_attribute)) {
372 // We add the field to the list of password fields if it was not flagged 373 // We add the field to the list of password fields if it was not flagged
373 // as a special NOT_PASSWORD prediction by Autofill. The NOT_PASSWORD 374 // as a special NOT_PASSWORD prediction by Autofill. The NOT_PASSWORD
374 // mechanism exists because some webpages use the type "password" for 375 // mechanism exists because some webpages use the type "password" for
375 // fields which Autofill knows shouldn't be treated as passwords by the 376 // fields which Autofill knows shouldn't be treated as passwords by the
376 // Password Manager. This is ultimately bypassed if the field has 377 // Password Manager. This is ultimately bypassed if the field has
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 } 632 }
632 633
633 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, 634 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element,
634 const char* value_in_lowercase) { 635 const char* value_in_lowercase) {
635 return base::LowerCaseEqualsASCII( 636 return base::LowerCaseEqualsASCII(
636 base::StringPiece16(element.getAttribute("autocomplete")), 637 base::StringPiece16(element.getAttribute("autocomplete")),
637 value_in_lowercase); 638 value_in_lowercase);
638 } 639 }
639 640
640 } // namespace autofill 641 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/password_autofill_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698