Chromium Code Reviews| Index: components/password_manager/core/browser/password_form_manager.cc |
| diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc |
| index a0e0be91a406ce592b869ed182207ffc7d065719..6cad9ad94419f3152b27b7a52ccbe183b00a6a17 100644 |
| --- a/components/password_manager/core/browser/password_form_manager.cc |
| +++ b/components/password_manager/core/browser/password_form_manager.cc |
| @@ -70,11 +70,12 @@ PasswordForm CopyAndModifySSLValidity(const PasswordForm& orig, |
| } // namespace |
| -PasswordFormManager::PasswordFormManager(PasswordManager* password_manager, |
| - PasswordManagerClient* client, |
| - PasswordManagerDriver* driver, |
| - const PasswordForm& observed_form, |
| - bool ssl_valid) |
| +PasswordFormManager::PasswordFormManager( |
| + PasswordManager* password_manager, |
| + PasswordManagerClient* client, |
| + const base::WeakPtr<PasswordManagerDriver>& driver, |
| + const PasswordForm& observed_form, |
| + bool ssl_valid) |
| : best_matches_deleter_(&best_matches_), |
| observed_form_(CopyAndModifySSLValidity(observed_form, ssl_valid)), |
| is_new_login_(true), |
| @@ -472,7 +473,8 @@ void PasswordFormManager::OnRequestDone( |
| if (best_score <= 0) { |
| // If no saved forms can be used, then it isn't blacklisted and generation |
| // should be allowed. |
| - driver_->AllowPasswordGenerationForForm(observed_form_); |
| + if (driver_) |
| + driver_->AllowPasswordGenerationForForm(observed_form_); |
| if (logger) |
| logger->LogNumber(Logger::STRING_BEST_SCORE, best_score); |
| return; |
| @@ -508,7 +510,8 @@ void PasswordFormManager::OnRequestDone( |
| // If not blacklisted, inform the driver that password generation is allowed |
| // for |observed_form_|. |
| - driver_->AllowPasswordGenerationForForm(observed_form_); |
| + if (driver_) |
| + driver_->AllowPasswordGenerationForForm(observed_form_); |
| MaybeTriggerAutofill(); |
| } |
| @@ -530,8 +533,10 @@ void PasswordFormManager::MaybeTriggerAutofill() { |
| manager_action_ = kManagerActionNone; |
| else |
| manager_action_ = kManagerActionAutofilled; |
| - password_manager_->Autofill(driver_, observed_form_, best_matches_, |
| - *preferred_match_, wait_for_username); |
| + if (driver_) { |
|
Evan Stade
2014/12/08 20:02:50
move this up to ~L521 for earlier abort?
vabr (Chromium)
2014/12/09 12:55:46
Done.
Skipping setting |manager_action_| is actual
|
| + password_manager_->Autofill(driver_.get(), observed_form_, best_matches_, |
| + *preferred_match_, wait_for_username); |
| + } |
| } |
| void PasswordFormManager::OnGetPasswordStoreResults( |
| @@ -550,7 +555,8 @@ void PasswordFormManager::OnGetPasswordStoreResults( |
| // No result means that we visit this site the first time so we don't need |
| // to check whether this site is blacklisted or not. Just send a message |
| // to allow password generation. |
| - driver_->AllowPasswordGenerationForForm(observed_form_); |
| + if (driver_) |
| + driver_->AllowPasswordGenerationForForm(observed_form_); |
| return; |
| } |
| OnRequestDone(results); |