Index: components/password_manager/content/browser/content_password_manager_driver.cc |
diff --git a/components/password_manager/content/browser/content_password_manager_driver.cc b/components/password_manager/content/browser/content_password_manager_driver.cc |
index bdb9361bb0d4e59cc27bff2ced8df2865d9756d8..ebf591eba28d1eafbd05664bb1316650c43502fa 100644 |
--- a/components/password_manager/content/browser/content_password_manager_driver.cc |
+++ b/components/password_manager/content/browser/content_password_manager_driver.cc |
@@ -43,6 +43,19 @@ ContentPasswordManagerDriver::ContentPasswordManagerDriver( |
// for this WebContents. |
VisiblePasswordObserver::CreateForWebContents( |
content::WebContents::FromRenderFrameHost(render_frame_host_)); |
+ |
+ // For some frames |this| may be instantiated before log manager creation, so |
+ // here we can not send logging state to renderer process for them. For such |
+ // cases, after the log manager got ready later, |
+ // ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability() will |
+ // call ContentPasswordManagerDriver::SendLoggingAvailability() on |this| to |
+ // do it actually. |
+ if (client_->GetLogManager()) { |
+ // Do not call the virtual method SendLoggingAvailability from a constructor |
+ // here, inline its steps instead. |
+ GetPasswordAutofillAgent()->SetLoggingState( |
+ client_->GetLogManager()->IsLoggingActive()); |
+ } |
} |
ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { |
@@ -278,10 +291,6 @@ void ContentPasswordManagerDriver::ShowNotSecureWarning( |
password_autofill_manager_.OnShowNotSecureWarning(text_direction, bounds); |
} |
-void ContentPasswordManagerDriver::PasswordAutofillAgentConstructed() { |
- SendLoggingAvailability(); |
-} |
- |
void ContentPasswordManagerDriver::RecordSavePasswordProgress( |
const std::string& log) { |
client_->GetLogManager()->LogSavePasswordProgress(log); |