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

Unified Diff: components/autofill/core/browser/address.cc

Issue 22009003: [Autofill] Distinguish between native field types and potentially HTML field types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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
« no previous file with comments | « components/autofill/core/browser/address.h ('k') | components/autofill/core/browser/address_field.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/address.cc
diff --git a/components/autofill/core/browser/address.cc b/components/autofill/core/browser/address.cc
index 2f1694e1cdb100038edf1947358a2bc660dd75ce..339352f8d53fab4bade5a3f21d68c38973aa6a02 100644
--- a/components/autofill/core/browser/address.cc
+++ b/components/autofill/core/browser/address.cc
@@ -13,7 +13,6 @@
#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_type.h"
-#include "components/autofill/core/browser/field_types.h"
namespace {
@@ -44,16 +43,7 @@ Address& Address::operator=(const Address& address) {
return *this;
}
-void Address::GetSupportedTypes(FieldTypeSet* supported_types) const {
- supported_types->insert(ADDRESS_HOME_LINE1);
- supported_types->insert(ADDRESS_HOME_LINE2);
- supported_types->insert(ADDRESS_HOME_CITY);
- supported_types->insert(ADDRESS_HOME_STATE);
- supported_types->insert(ADDRESS_HOME_ZIP);
- supported_types->insert(ADDRESS_HOME_COUNTRY);
-}
-
-base::string16 Address::GetRawInfo(AutofillFieldType type) const {
+base::string16 Address::GetRawInfo(ServerFieldType type) const {
type = AutofillType::GetEquivalentFieldType(type);
if (type == ADDRESS_HOME_LINE1)
return line1_;
@@ -76,7 +66,7 @@ base::string16 Address::GetRawInfo(AutofillFieldType type) const {
return base::string16();
}
-void Address::SetRawInfo(AutofillFieldType type, const base::string16& value) {
+void Address::SetRawInfo(ServerFieldType type, const base::string16& value) {
type = AutofillType::GetEquivalentFieldType(type);
if (type == ADDRESS_HOME_LINE1) {
line1_ = value;
@@ -96,32 +86,34 @@ void Address::SetRawInfo(AutofillFieldType type, const base::string16& value) {
}
}
-base::string16 Address::GetInfo(AutofillFieldType type,
+base::string16 Address::GetInfo(const AutofillType& type,
const std::string& app_locale) const {
- type = AutofillType::GetEquivalentFieldType(type);
- if (type == ADDRESS_HOME_COUNTRY && !country_code_.empty())
+ ServerFieldType server_type =
+ AutofillType::GetEquivalentFieldType(type.server_type());
+ if (server_type == ADDRESS_HOME_COUNTRY && !country_code_.empty())
return AutofillCountry(UTF16ToASCII(country_code_), app_locale).name();
- return GetRawInfo(type);
+ return GetRawInfo(server_type);
}
-bool Address::SetInfo(AutofillFieldType type,
+bool Address::SetInfo(const AutofillType& type,
const base::string16& value,
const std::string& app_locale) {
- type = AutofillType::GetEquivalentFieldType(type);
- if (type == ADDRESS_HOME_COUNTRY && !value.empty()) {
+ ServerFieldType server_type =
+ AutofillType::GetEquivalentFieldType(type.server_type());
+ if (server_type == ADDRESS_HOME_COUNTRY && !value.empty()) {
country_code_ =
ASCIIToUTF16(AutofillCountry::GetCountryCode(value, app_locale));
return !country_code_.empty();
}
- SetRawInfo(type, value);
+ SetRawInfo(server_type, value);
return true;
}
void Address::GetMatchingTypes(const base::string16& text,
const std::string& app_locale,
- FieldTypeSet* matching_types) const {
+ ServerFieldTypeSet* matching_types) const {
FormGroup::GetMatchingTypes(text, app_locale, matching_types);
// Check to see if the |text| canonicalized as a country name is a match.
@@ -130,4 +122,13 @@ void Address::GetMatchingTypes(const base::string16& text,
matching_types->insert(ADDRESS_HOME_COUNTRY);
}
+void Address::GetSupportedTypes(ServerFieldTypeSet* supported_types) const {
+ supported_types->insert(ADDRESS_HOME_LINE1);
+ supported_types->insert(ADDRESS_HOME_LINE2);
+ supported_types->insert(ADDRESS_HOME_CITY);
+ supported_types->insert(ADDRESS_HOME_STATE);
+ supported_types->insert(ADDRESS_HOME_ZIP);
+ supported_types->insert(ADDRESS_HOME_COUNTRY);
+}
+
} // namespace autofill
« no previous file with comments | « components/autofill/core/browser/address.h ('k') | components/autofill/core/browser/address_field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698