Chromium Code Reviews| Index: chrome/browser/password_manager/chrome_password_manager_client.cc |
| diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc |
| index ab2f0d809b36cca89f7ca3ab0c5df4836e784696..3468de330b2d661f57af0d00be4dbf95ed20afc9 100644 |
| --- a/chrome/browser/password_manager/chrome_password_manager_client.cc |
| +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc |
| @@ -26,6 +26,7 @@ |
| #include "components/autofill/content/common/autofill_messages.h" |
| #include "components/autofill/core/browser/password_generator.h" |
| #include "components/autofill/core/common/password_form.h" |
| +#include "components/password_manager/content/browser/content_password_manager_driver.h" |
| #include "components/password_manager/content/browser/password_manager_internals_service_factory.h" |
| #include "components/password_manager/content/common/credential_manager_messages.h" |
| #include "components/password_manager/content/common/credential_manager_types.h" |
| @@ -73,7 +74,8 @@ ChromePasswordManagerClient::ChromePasswordManagerClient( |
| observer_(NULL), |
| can_use_log_router_(false), |
| autofill_sync_state_(ALLOW_SYNC_CREDENTIALS), |
| - sync_credential_was_filtered_(false) { |
| + sync_credential_was_filtered_(false), |
| + render_frame_host_source_(NULL) { |
|
vabr (Chromium)
2014/11/10 14:34:38
NULL -> nullptr
("recommended for new code", http:
Evan Stade
2014/11/14 23:25:49
Done.
|
| PasswordManagerInternalsService* service = |
| PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
| if (service) |
| @@ -228,7 +230,7 @@ ChromePasswordManagerClient::GetPasswordStore() { |
| password_manager::PasswordManagerDriver* |
| ChromePasswordManagerClient::GetDriver() { |
| - return &driver_; |
| + return driver_.GetDriverForFrame(web_contents()->GetMainFrame()); |
| } |
| base::FieldTrial::Probability |
| @@ -290,35 +292,16 @@ bool ChromePasswordManagerClient::IsLoggingActive() const { |
| return can_use_log_router_ && !web_contents()->GetWebUI(); |
| } |
| -// static |
| -password_manager::PasswordGenerationManager* |
| -ChromePasswordManagerClient::GetGenerationManagerFromWebContents( |
| - content::WebContents* contents) { |
| - ChromePasswordManagerClient* client = |
| - ChromePasswordManagerClient::FromWebContents(contents); |
| - if (!client) |
| - return NULL; |
| - return client->GetDriver()->GetPasswordGenerationManager(); |
| -} |
| - |
| -// static |
| -password_manager::PasswordManager* |
| -ChromePasswordManagerClient::GetManagerFromWebContents( |
| - content::WebContents* contents) { |
| - ChromePasswordManagerClient* client = |
| - ChromePasswordManagerClient::FromWebContents(contents); |
| - if (!client) |
| - return NULL; |
| - return client->GetDriver()->GetPasswordManager(); |
| -} |
| - |
| void ChromePasswordManagerClient::SetTestObserver( |
| autofill::PasswordGenerationPopupObserver* observer) { |
| observer_ = observer; |
| } |
| bool ChromePasswordManagerClient::OnMessageReceived( |
| - const IPC::Message& message) { |
| + const IPC::Message& message, |
| + content::RenderFrameHost* render_frame_host) { |
| + render_frame_host_source_ = render_frame_host; |
| + |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(ChromePasswordManagerClient, message) |
| // Autofill messages: |
| @@ -334,6 +317,8 @@ bool ChromePasswordManagerClient::OnMessageReceived( |
| // Default: |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| + |
| + render_frame_host_source_ = NULL; |
|
vabr (Chromium)
2014/11/10 14:34:38
NULL -> nullptr
Evan Stade
2014/11/14 23:25:49
Done.
|
| return handled; |
| } |
| @@ -353,14 +338,10 @@ void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
| popup_controller_ = |
| autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| - popup_controller_, |
| - element_bounds_in_screen_space, |
| - form, |
| - max_length, |
| - driver_.GetPasswordManager(), |
| - observer_, |
| - web_contents(), |
| - web_contents()->GetNativeView()); |
| + popup_controller_, element_bounds_in_screen_space, form, max_length, |
| + driver_.GetDriverForFrame(render_frame_host_source_) |
| + ->GetPasswordManager(), |
| + observer_, web_contents(), web_contents()->GetNativeView()); |
| popup_controller_->Show(true /* display_password */); |
| } |
| @@ -370,14 +351,11 @@ void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
| gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| popup_controller_ = |
| autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| - popup_controller_, |
| - element_bounds_in_screen_space, |
| - form, |
| + popup_controller_, element_bounds_in_screen_space, form, |
| 0, // Unspecified max length. |
| - driver_.GetPasswordManager(), |
| - observer_, |
| - web_contents(), |
| - web_contents()->GetNativeView()); |
| + driver_.GetDriverForFrame(render_frame_host_source_) |
| + ->GetPasswordManager(), |
| + observer_, web_contents(), web_contents()->GetNativeView()); |
| popup_controller_->Show(false /* display_password */); |
| } |