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

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: Callback 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..d37da828811ee1f95da179efc2d35492f992772f 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,20 @@ 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);
Ilya Sherman 2013/07/27 01:09:48 Should you be calling pending_login_managers_.clea
Garrett Casto 2013/08/03 00:38:42 I actually did this on purpose, though now that I
+ for (size_t i = 0; i < submission_callbacks_.size(); ++i)
Ilya Sherman 2013/07/27 01:09:48 Optional nit: I prefer to always use curly braces
Garrett Casto 2013/08/03 00:38:42 Done.
+ submission_callbacks_[i].Run(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