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

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

Issue 686653003: Don't use FormFieldData only as a key in a map (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/password_manager/core/browser/password_autofill_manager.h
diff --git a/components/password_manager/core/browser/password_autofill_manager.h b/components/password_manager/core/browser/password_autofill_manager.h
index f3d4f5d7319c94eba7941b94e133f64375d587a4..4ad14b9b21b767031a710a82f24f8a5964a57b7f 100644
--- a/components/password_manager/core/browser/password_autofill_manager.h
+++ b/components/password_manager/core/browser/password_autofill_manager.h
@@ -8,6 +8,7 @@
#include <map>
#include "base/gtest_prod_util.h"
+#include "base/i18n/rtl.h"
#include "components/autofill/core/browser/autofill_client.h"
#include "components/autofill/core/browser/autofill_popup_delegate.h"
#include "components/autofill/core/common/password_form_fill_data.h"
@@ -39,12 +40,13 @@ class PasswordAutofillManager : public autofill::AutofillPopupDelegate {
// Invoked when a password mapping is added.
void OnAddPasswordFormMapping(
- const autofill::FormFieldData& field,
+ int key,
const autofill::PasswordFormFillData& fill_data);
// Handles a request from the renderer to show a popup with the given
// |suggestions| from the password manager.
- void OnShowPasswordSuggestions(const autofill::FormFieldData& field,
+ void OnShowPasswordSuggestions(int key,
+ base::i18n::TextDirection text_direction,
const base::string16& typed_username,
bool show_all,
const gfx::RectF& bounds);
@@ -53,26 +55,21 @@ class PasswordAutofillManager : public autofill::AutofillPopupDelegate {
void Reset();
// A public version of FillSuggestion(), only for use in tests.
- bool FillSuggestionForTest(const autofill::FormFieldData& field,
- const base::string16& username);
+ bool FillSuggestionForTest(int key, const base::string16& username);
// A public version of PreviewSuggestion(), only for use in tests.
- bool PreviewSuggestionForTest(const autofill::FormFieldData& field,
- const base::string16& username);
+ bool PreviewSuggestionForTest(int key, const base::string16& username);
private:
- typedef std::map<autofill::FormFieldData, autofill::PasswordFormFillData>
- LoginToPasswordInfoMap;
+ typedef std::map<int, autofill::PasswordFormFillData> LoginToPasswordInfoMap;
// Attempts to fill the password associated with user name |username|, and
// returns true if it was successful.
- bool FillSuggestion(const autofill::FormFieldData& field,
- const base::string16& username);
+ bool FillSuggestion(int key, const base::string16& username);
// Attempts to preview the password associated with user name |username|, and
// returns true if it was successful.
- bool PreviewSuggestion(const autofill::FormFieldData& field,
- const base::string16& username);
+ bool PreviewSuggestion(int key, const base::string16& username);
// If |current_username| matches a username for one of the login mappings in
// |fill_data|, returns true and assigns the password to |out_password|.
@@ -83,20 +80,20 @@ class PasswordAutofillManager : public autofill::AutofillPopupDelegate {
base::string16* out_password);
// Finds login information for a |node| that was previously filled.
- bool FindLoginInfo(const autofill::FormFieldData& field,
- autofill::PasswordFormFillData* found_password);
+ bool FindLoginInfo(int key, autofill::PasswordFormFillData* found_password);
// The logins we have filled so far with their associated info.
LoginToPasswordInfoMap login_to_password_info_;
+ // When the autofill popup should be shown, |form_data_key_| identifies the
+ // right password info in |login_to_password_info_|.
+ int form_data_key_;
+
// Provides embedder-level operations on passwords. Must outlive |this|.
PasswordManagerClient* const password_manager_client_; // weak
autofill::AutofillClient* const autofill_client_; // weak
- // The form field on which the autofill popup is shown.
- autofill::FormFieldData form_field_;
-
base::WeakPtrFactory<PasswordAutofillManager> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager);

Powered by Google App Engine
This is Rietveld 408576698