diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 15:20:21 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 15:20:21 +0000 |
commit | 8b366ad7e8264e13364686ff66183ecf3be2427e (patch) | |
tree | bc51f2b10d36319c6d5c26959fc18f701ef3807e /chrome/browser/autofill/autofill_profile.cc | |
parent | d3864f5c1b43d97fa80f2007c2dc24b4002c3d0a (diff) | |
download | chromium_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_profile.cc')
-rw-r--r-- | chrome/browser/autofill/autofill_profile.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc index 890f726..7a526cc 100644 --- a/chrome/browser/autofill/autofill_profile.cc +++ b/chrome/browser/autofill/autofill_profile.cc @@ -219,7 +219,14 @@ void AutofillProfile::SetMultiInfo(AutofillFieldType type, CopyValuesToItems(type, values, &fax_number_); break; default: - NOTREACHED() << "Attempt to set multiple values on single-valued field."; + if (values.size() == 1) { + SetInfo(type, values[0]); + } else if (values.size() == 0) { + SetInfo(type, string16()); + } else { + NOTREACHED() + << "Attempt to set multiple values on single-valued field."; + } break; } } @@ -240,9 +247,8 @@ void AutofillProfile::GetMultiInfo(AutofillFieldType type, CopyItemsToValues(type, fax_number_, values); break; default: - NOTREACHED() - << "Attempt to get multiple values from a single-valued field."; - break; + values->resize(1); + (*values)[0] = GetInfo(type); } } |