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

Unified Diff: components/password_manager/core/browser/password_manager.cc

Issue 343663002: PasswordManager: Add rendered forms to pending_login_managers_ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/password_manager/core/browser/password_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_manager.cc
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
index 4c0a4c3bcd07ce80ac680f2213bce96ca25bd886..d481abf07db15322cd1f3c7c9d09ebbf7f462860 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -310,10 +310,19 @@ void PasswordManager::OnPasswordFormSubmitted(
void PasswordManager::OnPasswordFormsParsed(
const std::vector<PasswordForm>& forms) {
+ CreatePendingLoginManagers(forms);
+}
+
+void PasswordManager::CreatePendingLoginManagers(
+ const std::vector<PasswordForm>& forms) {
// Don't try to autofill or save passwords in the presence of SSL errors.
if (driver_->DidLastPageLoadEncounterSSLErrors())
return;
+ // Copy the weak pointers to the currently known login managers for comparison
+ // against the newly added.
+ std::vector<PasswordFormManager*> old_login_managers(
+ pending_login_managers_.get());
for (std::vector<PasswordForm>::const_iterator iter = forms.begin();
iter != forms.end();
++iter) {
@@ -321,6 +330,16 @@ void PasswordManager::OnPasswordFormsParsed(
// SpdyProxy authentication, as indicated by the realm.
if (EndsWith(iter->signon_realm, kSpdyProxyRealm, true))
continue;
+ bool old_manager_found = false;
+ for (std::vector<PasswordFormManager*>::const_iterator old_manager =
+ old_login_managers.begin();
+ !old_manager_found && old_manager != old_login_managers.end();
+ ++old_manager) {
+ old_manager_found |= (*old_manager)->DoesManage(
+ *iter, PasswordFormManager::ACTION_MATCH_REQUIRED);
+ }
+ if (old_manager_found)
+ continue; // The current form is already managed.
bool ssl_valid = iter->origin.SchemeIsSecure();
PasswordFormManager* manager =
@@ -346,6 +365,8 @@ bool PasswordManager::ShouldPromptUserToSavePassword() const {
void PasswordManager::OnPasswordFormsRendered(
const std::vector<PasswordForm>& visible_forms) {
+ CreatePendingLoginManagers(visible_forms);
+
scoped_ptr<BrowserSavePasswordProgressLogger> logger;
if (client_->IsLoggingActive()) {
logger.reset(new BrowserSavePasswordProgressLogger(client_));
« no previous file with comments | « components/password_manager/core/browser/password_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698