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

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

Issue 19705013: [password autofill] Remove references to PasswordForm from RenderViewImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 5 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
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index e1390aa09be408671479aae117df546c7ac0f052..c45afd6513002599e5283febfaf6ad0f461d0844 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -210,6 +210,10 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) {
provisional_save_manager_.swap(manager);
}
+void PasswordManager::AddSubmissionObserver(SubmissionObserver* observer) {
+ submission_observers_.AddObserver(observer);
+}
+
void PasswordManager::AddObserver(LoginModelObserver* observer) {
observers_.AddObserver(observer);
}
@@ -218,20 +222,13 @@ void PasswordManager::RemoveObserver(LoginModelObserver* observer) {
observers_.RemoveObserver(observer);
}
-void PasswordManager::DidNavigateAnyFrame(
+void PasswordManager::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
- bool password_form_submitted = params.password_form.origin.is_valid();
-
- // Try to save the password if one was submitted.
- if (password_form_submitted)
- ProvisionallySavePassword(params.password_form);
-
- // Clear data after submission or main frame navigation. We don't want
- // to clear data after subframe navigation as there might be password
- // forms on other frames that could be submitted.
- if (password_form_submitted || details.is_main_frame)
- pending_login_managers_.clear();
+ // Clear data after main frame navigation. We don't want to clear data after
+ // subframe navigation as there might be password forms on other frames that
+ // could be submitted.
+ pending_login_managers_.clear();
}
bool PasswordManager::OnMessageReceived(const IPC::Message& message) {
@@ -241,11 +238,21 @@ bool PasswordManager::OnMessageReceived(const IPC::Message& message) {
OnPasswordFormsParsed)
IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsRendered,
OnPasswordFormsRendered)
+ IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormSubmitted,
+ OnPasswordFormSubmitted)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
+void PasswordManager::OnPasswordFormSubmitted(
+ const PasswordForm& password_form) {
+ ProvisionallySavePassword(password_form);
+ FOR_EACH_OBSERVER(SubmissionObserver,
+ submission_observers_,
+ PasswordSubmitted(password_form));
+}
+
void PasswordManager::OnPasswordFormsParsed(
const std::vector<PasswordForm>& forms) {
// Ask the SSLManager for current security.
@@ -311,7 +318,7 @@ void PasswordManager::OnPasswordFormsRendered(
if (provisional_save_manager_->HasGeneratedPassword())
UMA_HISTOGRAM_COUNTS("PasswordGeneration.Submitted", 1);
- if(!CommandLine::ForCurrentProcess()->HasSwitch(
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableSavePasswordBubble)){
if (ShouldShowSavePasswordInfoBar()) {
delegate_->AddSavePasswordInfoBarIfPermitted(
@@ -373,7 +380,7 @@ void PasswordManager::Autofill(
PossiblyInitializeUsernamesExperiment(best_matches);
switch (form_for_autofill.scheme) {
case PasswordForm::SCHEME_HTML: {
- // Note the check above is required because the observer_ for a non-HTML
+ // Note the check above is required because the observers_ for a non-HTML
// schemed password form may have been freed, so we need to distinguish.
autofill::PasswordFormFillData fill_data;
InitPasswordFormFillData(form_for_autofill,

Powered by Google App Engine
This is Rietveld 408576698