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

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

Issue 2947403003: Prefer the exact match over prefix match for the password manager filling.
Patch Set: Prefer the exact match over prefix match. Created 3 years, 6 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_autofill_agent.h" 5 #include "components/autofill/content/renderer/password_autofill_agent.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 445
446 base::string16 current_username; 446 base::string16 current_username;
447 if (!username_element->IsNull()) { 447 if (!username_element->IsNull()) {
448 current_username = username_element->Value().Utf16(); 448 current_username = username_element->Value().Utf16();
449 } 449 }
450 450
451 // username and password will contain the match found if any. 451 // username and password will contain the match found if any.
452 base::string16 username; 452 base::string16 username;
453 base::string16 password; 453 base::string16 password;
454 454
455 FindMatchesByUsername(fill_data, current_username, exact_username_match, 455 FindMatchesByUsername(fill_data, current_username,
456 logger, &username, &password); 456 true /* exact_username_match */, logger, &username,
457 &password);
458
459 if (!exact_username_match && password.empty()) {
460 FindMatchesByUsername(fill_data, current_username, exact_username_match,
461 logger, &username, &password);
462 }
457 463
458 if (password.empty()) 464 if (password.empty())
459 return false; 465 return false;
460 466
461 // TODO(tkent): Check maxlength and pattern for both username and password 467 // TODO(tkent): Check maxlength and pattern for both username and password
462 // fields. 468 // fields.
463 469
464 // Input matches the username, fill in required values. 470 // Input matches the username, fill in required values.
465 if (!username_element->IsNull() && 471 if (!username_element->IsNull() &&
466 IsElementAutocompletable(*username_element)) { 472 IsElementAutocompletable(*username_element)) {
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 PasswordAutofillAgent::GetPasswordManagerDriver() { 1790 PasswordAutofillAgent::GetPasswordManagerDriver() {
1785 if (!password_manager_driver_) { 1791 if (!password_manager_driver_) {
1786 render_frame()->GetRemoteInterfaces()->GetInterface( 1792 render_frame()->GetRemoteInterfaces()->GetInterface(
1787 mojo::MakeRequest(&password_manager_driver_)); 1793 mojo::MakeRequest(&password_manager_driver_));
1788 } 1794 }
1789 1795
1790 return password_manager_driver_; 1796 return password_manager_driver_;
1791 } 1797 }
1792 1798
1793 } // namespace autofill 1799 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698