| 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
|
|
|