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

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: Address gcasto's comments. 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: 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..c9f43549f68224f5e527fcaa1aa85eba264ca74a 100644
--- a/components/autofill/core/browser/password_autofill_manager.h
+++ b/components/autofill/core/browser/password_autofill_manager.h
@@ -16,6 +16,8 @@
#include "components/autofill/core/common/password_form_fill_data.h"
+class PasswordManagerClient;
+
namespace autofill {
class AutofillDriver;
@@ -23,12 +25,13 @@ 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

Powered by Google App Engine
This is Rietveld 408576698