Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1590)

Unified Diff: chrome/browser/password_manager/password_generation_manager.h

Issue 151413008: Move ownership of Password(Generation)Manager to ContentPasswordDriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle WebContents having no PasswordManagerDelegateImpl attached Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_generation_manager.h
diff --git a/chrome/browser/password_manager/password_generation_manager.h b/chrome/browser/password_manager/password_generation_manager.h
index 3eb4cbdf8b8e22e131113d944faad83659ebf8de..4bd316a44dd9ac411982507b5e435089ddd3cf68 100644
--- a/chrome/browser/password_manager/password_generation_manager.h
+++ b/chrome/browser/password_manager/password_generation_manager.h
@@ -12,6 +12,10 @@
#include "content/public/browser/web_contents_user_data.h"
#include "ui/gfx/rect.h"
+class PasswordManager;
+class PasswordManagerDelegate;
+class PasswordManagerDriver;
+
namespace autofill {
struct FormData;
class FormStructure;
@@ -38,10 +42,10 @@ class PrefRegistrySyncable;
// This class is used to determine what forms we should offer to generate
// passwords for and manages the popup which is created if the user chooses to
// generate a password.
-class PasswordGenerationManager
- : public content::WebContentsObserver,
- public content::WebContentsUserData<PasswordGenerationManager> {
+class PasswordGenerationManager : public content::WebContentsObserver {
public:
+ PasswordGenerationManager(content::WebContents* contents,
+ PasswordManagerDelegate* delegate);
virtual ~PasswordGenerationManager();
// Detect account creation forms from forms with autofill type annotated.
@@ -56,11 +60,7 @@ class PasswordGenerationManager
// Observer for PasswordGenerationPopup events. Used for testing.
void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer);
- protected:
- explicit PasswordGenerationManager(content::WebContents* contents);
-
private:
- friend class content::WebContentsUserData<PasswordGenerationManager>;
friend class PasswordGenerationManagerTest;
// WebContentsObserver:
@@ -102,6 +102,14 @@ class PasswordGenerationManager
base::WeakPtr<
autofill::PasswordGenerationPopupControllerImpl> popup_controller_;
+ // The PasswordManagerDelegate instance associated with this instance. Must
+ // outlive this instance.
+ PasswordManagerDelegate* delegate_;
+
+ // The PasswordManagerDriver instance associated with this instance. Must
+ // outlive this instance.
+ PasswordManagerDriver* driver_;
+
DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager);
};

Powered by Google App Engine
This is Rietveld 408576698