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

Unified Diff: chrome/browser/password_manager/password_manager.cc

Issue 137783003: Password manager: improve the check for login failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding a comment about DoesManage Created 6 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/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/password_manager/password_manager.cc
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index eb6adfc9ba7557a439379f098998a076c363657d..38a5dffb6aee0ca96f125a260e89bbda01e467bf 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -350,12 +350,18 @@ void PasswordManager::OnPasswordFormsRendered(
DCHECK(IsSavingEnabled());
- // We now assume that if there is at least one visible password form
- // that means that the previous login attempt failed.
- if (!visible_forms.empty()) {
- provisional_save_manager_->SubmitFailed();
- provisional_save_manager_.reset();
- return;
+ // If we see the login form again, then the login failed.
+ for (size_t i = 0; i < visible_forms.size(); ++i) {
+ // TODO(vabr): The similarity check is just action equality for now. If it
+ // becomes more complex, it may make sense to consider modifying and using
+ // PasswordFormManager::DoesManage for it.
+ if (visible_forms[i].action.is_valid() &&
+ provisional_save_manager_->pending_credentials().action ==
+ visible_forms[i].action) {
+ provisional_save_manager_->SubmitFailed();
+ provisional_save_manager_.reset();
+ return;
+ }
}
// Looks like a successful login attempt. Either show an infobar or
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698