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

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

Issue 10892011: Fix for no password save when action URL is modified (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
Index: chrome/browser/password_manager/password_manager.cc
===================================================================
--- chrome/browser/password_manager/password_manager.cc (revision 152419)
+++ chrome/browser/password_manager/password_manager.cc (working copy)
@@ -114,22 +114,34 @@
return;
scoped_ptr<PasswordFormManager> manager;
+ ScopedVector<PasswordFormManager>::iterator matched_manager_it =
+ pending_login_managers_.end();
for (ScopedVector<PasswordFormManager>::iterator iter =
pending_login_managers_.begin();
iter != pending_login_managers_.end(); ++iter) {
- if ((*iter)->DoesManage(form)) {
- // Transfer ownership of the manager from |pending_login_managers_| to
- // |manager|.
- manager.reset(*iter);
- pending_login_managers_.weak_erase(iter);
+ // If we find a manager that exactly matches the submitted form including
+ // the action URL, exit the loop.
+ if ((*iter)->DoesManage(form, true)) {
+ matched_manager_it = iter;
break;
+ // If the current manager matches the submitted form excluding the action
+ // URL, remember it as a candidate and continue searching for an exact
+ // match.
+ } else if ((*iter)->DoesManage(form, false)) {
+ matched_manager_it = iter;
}
}
// If we didn't find a manager, this means a form was submitted without
// first loading the page containing the form. Don't offer to save
// passwords in this case.
- if (!manager.get())
+ if (matched_manager_it != pending_login_managers_.end()) {
+ // Transfer ownership of the manager from |pending_login_managers_| to
+ // |manager|.
+ manager.reset(*matched_manager_it);
+ pending_login_managers_.weak_erase(matched_manager_it);
+ } else {
return;
+ }
// If we found a manager but it didn't finish matching yet, the user has
// tried to submit credentials before we had time to even find matching

Powered by Google App Engine
This is Rietveld 408576698