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 76c505dde49684d960eaf29ea1e8007a5fb3704b..402754cfafaa5169b6b0499bdebcd0554eef99d8 100644 |
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc |
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc |
@@ -28,7 +28,6 @@ |
#include "chrome/common/url_constants.h" |
#include "components/autofill/content/browser/content_autofill_driver.h" |
#include "components/autofill/content/browser/content_autofill_driver_factory.h" |
-#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/browser_sync/profile_sync_service.h" |
@@ -142,6 +141,7 @@ ChromePasswordManagerClient::ChromePasswordManagerClient( |
password_manager_(this), |
driver_factory_(nullptr), |
credential_manager_impl_(web_contents, this), |
+ password_manager_client_bindings_(web_contents, this), |
observer_(nullptr), |
credentials_filter_(this, |
base::Bind(&GetSyncService, profile_), |
@@ -455,31 +455,6 @@ void ChromePasswordManagerClient::SetTestObserver( |
observer_ = observer; |
} |
-bool ChromePasswordManagerClient::OnMessageReceived( |
- const IPC::Message& message, |
- content::RenderFrameHost* render_frame_host) { |
- bool handled = true; |
- IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(ChromePasswordManagerClient, message, |
- render_frame_host) |
- // Autofill messages: |
- IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup, |
- ShowPasswordGenerationPopup) |
- IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordEditingPopup, |
- ShowPasswordEditingPopup) |
- IPC_END_MESSAGE_MAP() |
- |
- IPC_BEGIN_MESSAGE_MAP(ChromePasswordManagerClient, message) |
- IPC_MESSAGE_HANDLER(AutofillHostMsg_HidePasswordGenerationPopup, |
- HidePasswordGenerationPopup) |
- IPC_MESSAGE_HANDLER(AutofillHostMsg_GenerationAvailableForForm, |
- GenerationAvailableForForm) |
- // Default: |
- IPC_MESSAGE_UNHANDLED(handled = false) |
- IPC_END_MESSAGE_MAP() |
- |
- return handled; |
-} |
- |
void ChromePasswordManagerClient::DidStartNavigation( |
content::NavigationHandle* navigation_handle) { |
// Logging has no sense on WebUI sites. |
@@ -493,7 +468,6 @@ gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace( |
} |
void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
- content::RenderFrameHost* render_frame_host, |
const gfx::RectF& bounds, |
int max_length, |
const base::string16& generation_element, |
@@ -501,7 +475,8 @@ void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
const autofill::PasswordForm& form) { |
// TODO(gcasto): Validate data in PasswordForm. |
- auto* driver = driver_factory_->GetDriverForFrame(render_frame_host); |
+ auto* driver = driver_factory_->GetDriverForFrame( |
+ password_manager_client_bindings_.GetCurrentTargetFrame()); |
password_manager_.SetGenerationElementAndReasonForForm( |
driver, form, generation_element, is_manually_triggered); |
gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
@@ -515,7 +490,6 @@ void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
} |
void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
- content::RenderFrameHost* render_frame_host, |
const gfx::RectF& bounds, |
const autofill::PasswordForm& form) { |
gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
@@ -524,8 +498,9 @@ void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
popup_controller_, element_bounds_in_screen_space, form, |
0, // Unspecified max length. |
&password_manager_, |
- driver_factory_->GetDriverForFrame(render_frame_host), observer_, |
- web_contents(), web_contents()->GetNativeView()); |
+ driver_factory_->GetDriverForFrame( |
+ password_manager_client_bindings_.GetCurrentTargetFrame()), |
+ observer_, web_contents(), web_contents()->GetNativeView()); |
popup_controller_->Show(false /* display_password */); |
} |