summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_manager.h
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 15:20:21 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 15:20:21 +0000
commit8b366ad7e8264e13364686ff66183ecf3be2427e (patch)
treebc51f2b10d36319c6d5c26959fc18f701ef3807e /chrome/browser/autofill/autofill_manager.h
parentd3864f5c1b43d97fa80f2007c2dc24b4002c3d0a (diff)
downloadchromium_src-8b366ad7e8264e13364686ff66183ecf3be2427e.zip
chromium_src-8b366ad7e8264e13364686ff66183ecf3be2427e.tar.gz
chromium_src-8b366ad7e8264e13364686ff66183ecf3be2427e.tar.bz2
Autofill extend profiles to include multi-valued fields, part 5 (Filling)
Modifies Autofill filling logic to use multi-valued fields where appropriate. There are two cases: (1) Filling unfilled forms. In this case the default behavior is unchanged. If however the user triggers suggestions with typed characters "Cy", say, then non-default values show up as suggestions if they match. In this example, if { "Bob", "Cynthia" } are two names in a profile, then "Cynthia" would show as a suggestion. (2) Filling previously filled forms. In this case suggestions are show for the matching string, *and* any secondary values if there are any. BUG=65625 TEST=AutofillManagerTest.GetFieldSuggestionsForMultiValuedProfile* Review URL: http://codereview.chromium.org/6810028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_manager.h')
-rw-r--r--chrome/browser/autofill/autofill_manager.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h
index 26667c0..2bdbb20 100644
--- a/chrome/browser/autofill/autofill_manager.h
+++ b/chrome/browser/autofill/autofill_manager.h
@@ -84,7 +84,13 @@ class AutofillManager : public TabContentsObserver,
void Reset();
protected:
- // For tests.
+ // For tests:
+
+ // The string/int pair is composed of the guid string and variant index
+ // respectively. The variant index is an index into the multi-valued item
+ // (where applicable).
+ typedef std::pair<std::string, size_t> GUIDPair;
+
AutofillManager(TabContents* tab_contents,
PersonalDataManager* personal_data);
@@ -99,13 +105,13 @@ class AutofillManager : public TabContentsObserver,
// Maps GUIDs to and from IDs that are used to identify profiles and credit
// cards sent to and from the renderer process.
- virtual int GUIDToID(const std::string& guid);
- virtual const std::string IDToGUID(int id);
+ virtual int GUIDToID(const GUIDPair& guid);
+ virtual const GUIDPair IDToGUID(int id);
// Methods for packing and unpacking credit card and profile IDs for sending
// and receiving to and from the renderer process.
- int PackGUIDs(const std::string& cc_guid, const std::string& profile_guid);
- void UnpackGUIDs(int id, std::string* cc_guid, std::string* profile_guid);
+ int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid);
+ void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid);
private:
void OnFormSubmitted(const webkit_glue::FormData& form);
@@ -169,14 +175,18 @@ class AutofillManager : public TabContentsObserver,
webkit_glue::FormField* field);
// Set |field| argument's value based on |type| and contents of the |profile|.
+ // The |variant| parameter specifies which value in a multi-valued profile.
void FillFormField(const AutofillProfile* profile,
AutofillFieldType type,
+ size_t variant,
webkit_glue::FormField* field);
// Set |field| argument's value for phone/fax number based on contents of the
// |profile|. |type| is the type of the phone.
+ // The |variant| parameter specifies which value in a multi-valued profile.
void FillPhoneNumberField(const AutofillProfile* profile,
AutofillFieldType type,
+ size_t variant,
webkit_glue::FormField* field);
// Parses the forms using heuristic matching and querying the Autofill server.
@@ -217,8 +227,8 @@ class AutofillManager : public TabContentsObserver,
bool has_logged_address_suggestions_count_;
// GUID to ID mapping. We keep two maps to convert back and forth.
- std::map<std::string, int> guid_id_map_;
- std::map<int, std::string> id_guid_map_;
+ std::map<GUIDPair, int> guid_id_map_;
+ std::map<int, GUIDPair> id_guid_map_;
friend class AutofillManagerTest;
friend class FormStructureBrowserTest;