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

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: Created 7 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
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index dbeec6b27480552cb19fb5626680514dd9adb1d5..7c1f8979900cae677d5ba194dc50bf771d840da2 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -210,6 +210,11 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) {
provisional_save_manager_.swap(manager);
}
+void PasswordManager::AddSubmissionCallback(
+ const PasswordSubmittedCallback& callback) {
+ submission_callbacks_.push_back(callback);
+}
+
void PasswordManager::AddObserver(LoginModelObserver* observer) {
observers_.AddObserver(observer);
}
@@ -218,20 +223,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 +239,23 @@ 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 (size_t i = 0; i < submission_callbacks_.size(); ++i) {
+ submission_callbacks_[i].Run(password_form);
+ }
+
+ pending_login_managers_.clear();
+}
+
void PasswordManager::OnPasswordFormsParsed(
const std::vector<PasswordForm>& forms) {
// Ask the SSLManager for current security.
@@ -373,7 +383,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,
« no previous file with comments | « chrome/browser/password_manager/password_manager.h ('k') | chrome/browser/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698