summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_profile.cc
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 07:14:46 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 07:14:46 +0000
commit8cd6d5c7e49b72dc20136fb6e92432cca5a2942a (patch)
treea83ae25be2c344869b645ee47ad8b64c220256cb /chrome/browser/autofill/autofill_profile.cc
parent0eab1190912cd938f12c1d965cb86adac535e9f2 (diff)
downloadchromium_src-8cd6d5c7e49b72dc20136fb6e92432cca5a2942a.zip
chromium_src-8cd6d5c7e49b72dc20136fb6e92432cca5a2942a.tar.gz
chromium_src-8cd6d5c7e49b72dc20136fb6e92432cca5a2942a.tar.bz2
Autofill billing and shipping addresses separately.
When autofilling a form that asks for both a shipping and a billing address, we should try to fill them separately, rather than filling both with the same data. BUG=61678 TEST=unit_tests --gtest_filter=AutoFillManagerTest.FillFormWithMultipleSections Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=73700 Review URL: http://codereview.chromium.org/6334081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_profile.cc')
-rw-r--r--chrome/browser/autofill/autofill_profile.cc44
1 files changed, 7 insertions, 37 deletions
diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc
index 1ec7b30..f6bcb13 100644
--- a/chrome/browser/autofill/autofill_profile.cc
+++ b/chrome/browser/autofill/autofill_profile.cc
@@ -11,6 +11,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/address.h"
#include "chrome/browser/autofill/autofill_manager.h"
+#include "chrome/browser/autofill/autofill_type.h"
#include "chrome/browser/autofill/contact_info.h"
#include "chrome/browser/autofill/fax_number.h"
#include "chrome/browser/autofill/home_address.h"
@@ -28,48 +29,15 @@ void InitPersonalInfo(FormGroupMap* personal_info) {
(*personal_info)[AutoFillType::ADDRESS_HOME] = new HomeAddress();
}
-// Maps |field_type| to a field type that can be directly stored in a profile
-// (in the sense that it makes sense to call |AutoFillProfile::SetInfo()| with
-// the returned field type as the first parameter.
-AutoFillFieldType GetEquivalentFieldType(AutoFillFieldType field_type) {
- // When billing information is requested from the profile we map to the
- // home address equivalents.
- switch (field_type) {
- case ADDRESS_BILLING_LINE1:
- return ADDRESS_HOME_LINE1;
-
- case ADDRESS_BILLING_LINE2:
- return ADDRESS_HOME_LINE2;
-
- case ADDRESS_BILLING_APT_NUM:
- return ADDRESS_HOME_APT_NUM;
-
- case ADDRESS_BILLING_CITY:
- return ADDRESS_HOME_CITY;
-
- case ADDRESS_BILLING_STATE:
- return ADDRESS_HOME_STATE;
-
- case ADDRESS_BILLING_ZIP:
- return ADDRESS_HOME_ZIP;
-
- case ADDRESS_BILLING_COUNTRY:
- return ADDRESS_HOME_COUNTRY;
-
- default:
- return field_type;
- }
-}
-
-// Like |GetEquivalentFieldType()| above, but also returns |NAME_FULL| for
-// first, middle, and last name field types.
+// Like |AutoFillType::GetEquivalentFieldType()|, but also returns |NAME_FULL|
+// for first, middle, and last name field types.
AutoFillFieldType GetEquivalentFieldTypeCollapsingNames(
AutoFillFieldType field_type) {
if (field_type == NAME_FIRST || field_type == NAME_MIDDLE ||
field_type == NAME_LAST)
return NAME_FULL;
- return GetEquivalentFieldType(field_type);
+ return AutoFillType::GetEquivalentFieldType(field_type);
}
// Fills |distinguishing_fields| with a list of fields to use when creating
@@ -182,7 +150,9 @@ void AutoFillProfile::GetAvailableFieldTypes(
}
string16 AutoFillProfile::GetFieldText(const AutoFillType& type) const {
- AutoFillType return_type(GetEquivalentFieldType(type.field_type()));
+ AutoFillType return_type(
+ AutoFillType::GetEquivalentFieldType(type.field_type()));
+
FormGroupMap::const_iterator iter = personal_info_.find(return_type.group());
if (iter == personal_info_.end() || iter->second == NULL)
return string16();