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

Unified Diff: components/autofill/core/browser/password_autofill_manager.h

Issue 184103016: Autofill: Refactoring to support fetching password after a username is selected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor PasswordAutofillManager in password_manager component. Created 6 years, 9 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: components/autofill/core/browser/password_autofill_manager.h
diff --git a/components/autofill/core/browser/password_autofill_manager.h b/components/autofill/core/browser/password_autofill_manager.h
index ddde78eb0faa337f9a1ef49f98af8daca681e231..ed0b67f5cd2a721e651634e9606b1cb3c8d34035 100644
--- a/components/autofill/core/browser/password_autofill_manager.h
+++ b/components/autofill/core/browser/password_autofill_manager.h
@@ -16,19 +16,22 @@
#include "components/autofill/core/common/password_form_fill_data.h"
-namespace autofill {
+class PasswordManagerClient;
+namespace autofill {
class AutofillDriver;
+}
// This class is responsible for filling password forms.
class PasswordAutofillManager {
public:
- explicit PasswordAutofillManager(AutofillDriver* autofill_driver);
+ PasswordAutofillManager(
+ PasswordManagerClient* password_manager_client,
+ AutofillDriver* autofill_driver);
virtual ~PasswordAutofillManager();
- // Fills the password associated with user name |username|. Returns true if
- // the username and password fields were filled, false otherwise.
- bool DidAcceptAutofillSuggestion(const FormFieldData& field,
+ // Fills the password associated with user name |username|.
+ void DidAcceptAutofillSuggestion(const FormFieldData& field,
const base::string16& username);
// Invoked when a password mapping is added.
@@ -43,15 +46,15 @@ class PasswordAutofillManager {
// TODO(csharp): Modify the AutofillExternalDeletegate code so that it can
// figure out if a entry is a password one without using this mapping.
// crbug.com/118601
- typedef std::map<FormFieldData,
- PasswordFormFillData>
- LoginToPasswordInfoMap;
+ typedef std::map<FormFieldData, PasswordFormFillData> LoginToPasswordInfoMap;
- // Returns true if |current_username| matches a username for one of the
- // login mappings in |password|.
- bool WillFillUserNameAndPassword(
+ // If |current_username| matches a username for one of the login mappings in
+ // |fill_data|, returns true and assigns the password to |out_password|.
+ // Otherwise, returns false and leaves |out_password| untouched.
+ bool GetPasswordForUsername(
const base::string16& current_username,
- const PasswordFormFillData& password);
+ const PasswordFormFillData& fill_data,
+ base::string16* out_password);
// Finds login information for a |node| that was previously filled.
bool FindLoginInfo(const FormFieldData& field,
@@ -60,6 +63,9 @@ class PasswordAutofillManager {
// The logins we have filled so far with their associated info.
LoginToPasswordInfoMap login_to_password_info_;
+ // Provides embedder-level operations on passwords. Must outlive |this|.
+ PasswordManagerClient* const password_manager_client_; // weak
+
// Provides driver-level context to the shared code of the component. Must
// outlive |this|.
AutofillDriver* const autofill_driver_; // weak
@@ -67,6 +73,4 @@ class PasswordAutofillManager {
DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager);
};
-} // namespace autofill
-
#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698