summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 10:06:39 +0000
committerblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 10:06:39 +0000
commit5feea69045b274708422543072f7d2ee12767328 (patch)
treef7f6bae35b99c2430cd8f6de5221f9e215fd777f
parentb32260f92786a8d3f7adef89dda53e044806f00c (diff)
downloadchromium_src-5feea69045b274708422543072f7d2ee12767328.zip
chromium_src-5feea69045b274708422543072f7d2ee12767328.tar.gz
chromium_src-5feea69045b274708422543072f7d2ee12767328.tar.bz2
Move Password(Generation)Manager IPC reception to ContentPasswordDriver
This CL exposes the methods that PasswordManager and PasswordGenerationManager use in response to IPC as public APIs on those classes, and moves the IPC handling into ContentPasswordDriver. BUG=340669, 340690 NOTRY=true Review URL: https://codereview.chromium.org/136093012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249325 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/password_manager/content_password_manager_driver.cc28
-rw-r--r--chrome/browser/password_manager/password_generation_manager.cc16
-rw-r--r--chrome/browser/password_manager/password_generation_manager.h31
-rw-r--r--chrome/browser/password_manager/password_manager.cc14
-rw-r--r--chrome/browser/password_manager/password_manager.h17
5 files changed, 41 insertions, 65 deletions
diff --git a/chrome/browser/password_manager/content_password_manager_driver.cc b/chrome/browser/password_manager/content_password_manager_driver.cc
index 7a0896d..035dbec 100644
--- a/chrome/browser/password_manager/content_password_manager_driver.cc
+++ b/chrome/browser/password_manager/content_password_manager_driver.cc
@@ -13,6 +13,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/ssl_status.h"
+#include "ipc/ipc_message_macros.h"
#include "net/cert/cert_status_flags.h"
ContentPasswordManagerDriver::ContentPasswordManagerDriver(
@@ -67,7 +68,28 @@ void ContentPasswordManagerDriver::DidNavigateMainFrame(
bool ContentPasswordManagerDriver::OnMessageReceived(
const IPC::Message& message) {
- if (password_manager_.OnMessageReceived(message))
- return true;
- return password_generation_manager_.OnMessageReceived(message);
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(PasswordManager, message)
+ IPC_MESSAGE_FORWARD(AutofillHostMsg_PasswordFormsParsed,
+ &password_manager_,
+ PasswordManager::OnPasswordFormsParsed)
+ IPC_MESSAGE_FORWARD(AutofillHostMsg_PasswordFormsRendered,
+ &password_manager_,
+ PasswordManager::OnPasswordFormsRendered)
+ IPC_MESSAGE_FORWARD(AutofillHostMsg_PasswordFormSubmitted,
+ &password_manager_,
+ PasswordManager::OnPasswordFormSubmitted)
+ IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordGenerationPopup,
+ &password_generation_manager_,
+ PasswordGenerationManager::OnShowPasswordGenerationPopup)
+ IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordEditingPopup,
+ &password_generation_manager_,
+ PasswordGenerationManager::OnShowPasswordEditingPopup)
+ IPC_MESSAGE_FORWARD(AutofillHostMsg_HidePasswordGenerationPopup,
+ &password_generation_manager_,
+ PasswordGenerationManager::OnHidePasswordGenerationPopup)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+
+ return handled;
}
diff --git a/chrome/browser/password_manager/password_generation_manager.cc b/chrome/browser/password_manager/password_generation_manager.cc
index 6428beb..45352eb 100644
--- a/chrome/browser/password_manager/password_generation_manager.cc
+++ b/chrome/browser/password_manager/password_generation_manager.cc
@@ -25,7 +25,6 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
-#include "ipc/ipc_message_macros.h"
#include "ui/gfx/rect.h"
PasswordGenerationManager::PasswordGenerationManager(
@@ -64,21 +63,6 @@ void PasswordGenerationManager::DetectAccountCreationForms(
}
}
-bool PasswordGenerationManager::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PasswordGenerationManager, message)
- IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup,
- OnShowPasswordGenerationPopup)
- IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordEditingPopup,
- OnShowPasswordEditingPopup)
- IPC_MESSAGE_HANDLER(AutofillHostMsg_HidePasswordGenerationPopup,
- OnHidePasswordGenerationPopup)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
-
- return handled;
-}
-
// In order for password generation to be enabled, we need to make sure:
// (1) Password sync is enabled, and
// (2) Password saving is enabled.
diff --git a/chrome/browser/password_manager/password_generation_manager.h b/chrome/browser/password_manager/password_generation_manager.h
index 3128c51..62d827a 100644
--- a/chrome/browser/password_manager/password_generation_manager.h
+++ b/chrome/browser/password_manager/password_generation_manager.h
@@ -30,10 +30,6 @@ class RenderViewHost;
class WebContents;
}
-namespace IPC {
-class Message;
-}
-
namespace user_prefs {
class PrefRegistrySyncable;
}
@@ -69,8 +65,18 @@ class PasswordGenerationManager {
// Observer for PasswordGenerationPopup events. Used for testing.
void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer);
- // TODO(blundell): Eliminate this method. crbug.com/340690
- bool OnMessageReceived(const IPC::Message& message);
+ // Causes the password generation UI to be shown for the specified form.
+ // The popup will be anchored at |element_bounds|. The generated password
+ // will be no longer than |max_length|.
+ void OnShowPasswordGenerationPopup(const gfx::RectF& element_bounds,
+ int max_length,
+ const autofill::PasswordForm& form);
+
+ // Causes the password editing UI to be shown anchored at |element_bounds|.
+ void OnShowPasswordEditingPopup(const gfx::RectF& element_bounds);
+
+ // Hides any visible UI.
+ void OnHidePasswordGenerationPopup();
private:
friend class PasswordGenerationManagerTest;
@@ -88,19 +94,6 @@ class PasswordGenerationManager {
// in the screens coordinate system.
gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds);
- // Causes the password generation UI to be shown for the specified form.
- // The popup will be anchored at |element_bounds|. The generated password
- // will be no longer than |max_length|.
- void OnShowPasswordGenerationPopup(const gfx::RectF& element_bounds,
- int max_length,
- const autofill::PasswordForm& form);
-
- // Causes the password editing UI to be shown anchored at |element_bounds|.
- void OnShowPasswordEditingPopup(const gfx::RectF& element_bounds);
-
- // Hide any visible UI.
- void OnHidePasswordGenerationPopup();
-
// The WebContents instance associated with this instance. Scoped to the
// lifetime of this class, as this class is indirectly a WCUD via
// PasswordManagerDelegateImpl.
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index e19461d..472314e 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -261,20 +261,6 @@ void PasswordManager::DidNavigateMainFrame(bool is_in_page) {
pending_login_managers_.clear();
}
-bool PasswordManager::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PasswordManager, message)
- IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormsParsed,
- 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);
diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h
index 6bb958e..94dcf70 100644
--- a/chrome/browser/password_manager/password_manager.h
+++ b/chrome/browser/password_manager/password_manager.h
@@ -17,7 +17,6 @@
#include "chrome/browser/ui/login/login_model.h"
#include "components/autofill/core/common/password_form.h"
#include "components/autofill/core/common/password_form_fill_data.h"
-#include "ipc/ipc_message_macros.h"
class PasswordManagerDelegate;
class PasswordManagerDriver;
@@ -29,10 +28,6 @@ namespace content {
class WebContents;
}
-namespace IPC {
-class Message;
-}
-
namespace user_prefs {
class PrefRegistrySyncable;
}
@@ -88,19 +83,15 @@ class PasswordManager : public LoginModel {
// Should be called when the user navigates the main frame.
void DidNavigateMainFrame(bool is_in_page);
- // TODO(blundell): Eliminate this method. crbug.com/340669
- bool OnMessageReceived(const IPC::Message& message);
-
- // TODO(isherman): This should not be public, but is currently being used by
- // the LoginPrompt code.
+ // Handles password forms being parsed.
void OnPasswordFormsParsed(
const std::vector<autofill::PasswordForm>& forms);
+
+ // Handles password forms being rendered.
void OnPasswordFormsRendered(
const std::vector<autofill::PasswordForm>& visible_forms);
- protected:
-
- // Handle notification that a password form was submitted.
+ // Handles a password form being submitted.
virtual void OnPasswordFormSubmitted(
const autofill::PasswordForm& password_form);