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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_state.cc

Issue 1620083003: Fix best credentials selection algorithm in Password Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests added Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/passwords/manage_passwords_state.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_state.cc b/chrome/browser/ui/passwords/manage_passwords_state.cc
index 8f2cfcc39a3d5e986da51557aa3288c0812c005b..d773baf1a2ee860f5dd64cc70cb8f536c34f8a97 100644
--- a/chrome/browser/ui/passwords/manage_passwords_state.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_state.cc
@@ -155,7 +155,13 @@ void ManagePasswordsState::OnPasswordAutofilled(
// TODO(vabr): Revert back to DCHECK once http://crbug.com/486931 is fixed.
CHECK(!password_form_map.empty());
ClearData();
- if (password_form_map.begin()->second->is_public_suffix_match) {
+ bool only_PSL_matches =
+ find_if(password_form_map.begin(), password_form_map.end(),
+ [](const std::pair<const base::string16,
+ scoped_ptr<autofill::PasswordForm>>& p) {
+ return !p.second->is_public_suffix_match;
+ }) == password_form_map.end();
+ if (only_PSL_matches) {
// Don't show the UI for PSL matched passwords. They are not stored for this
// page and cannot be deleted.
origin_ = GURL();
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698