Commit abda9bb2 authored by Matthias Körber's avatar Matthias Körber Committed by Commit Bot

[Autofill] Added conversion from ServerFieldType to StringPiece

Also removed some duplicated code that slipped through.

Change-Id: I15a4a8e7572e8ec07782b818c2eb193afd0baea7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2300084
Commit-Queue: Matthias Körber <koerber@google.com>
Commit-Queue: Christoph Schwering <schwering@google.com>
Reviewed-by: default avatarChristoph Schwering <schwering@google.com>
Auto-Submit: Matthias Körber <koerber@google.com>
Cr-Commit-Position: refs/heads/master@{#792245}
parent d46c0139
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "components/autofill/core/browser/autofill_type.h" #include "components/autofill/core/browser/autofill_type.h"
#include "base/notreached.h" #include "base/notreached.h"
#include "base/strings/string_piece.h"
namespace autofill { namespace autofill {
...@@ -458,301 +459,12 @@ std::string AutofillType::ToString() const { ...@@ -458,301 +459,12 @@ std::string AutofillType::ToString() const {
if (server_type_ != UNKNOWN_TYPE) if (server_type_ != UNKNOWN_TYPE)
return ServerFieldTypeToString(server_type_); return ServerFieldTypeToString(server_type_);
switch (html_type_) { return FieldTypeToStringPiece(html_type_).as_string();
case HTML_TYPE_UNSPECIFIED:
case HTML_TYPE_UNRECOGNIZED:
NOTREACHED();
break;
case HTML_TYPE_NAME:
return "HTML_TYPE_NAME";
case HTML_TYPE_HONORIFIC_PREFIX:
return "HTML_TYPE_HONORIFIC_PREFIX";
case HTML_TYPE_GIVEN_NAME:
return "HTML_TYPE_GIVEN_NAME";
case HTML_TYPE_ADDITIONAL_NAME:
return "HTML_TYPE_ADDITIONAL_NAME";
case HTML_TYPE_FAMILY_NAME:
return "HTML_TYPE_FAMILY_NAME";
case HTML_TYPE_ORGANIZATION:
return "HTML_TYPE_ORGANIZATION";
case HTML_TYPE_STREET_ADDRESS:
return "HTML_TYPE_STREET_ADDRESS";
case HTML_TYPE_ADDRESS_LINE1:
return "HTML_TYPE_ADDRESS_LINE1";
case HTML_TYPE_ADDRESS_LINE2:
return "HTML_TYPE_ADDRESS_LINE2";
case HTML_TYPE_ADDRESS_LINE3:
return "HTML_TYPE_ADDRESS_LINE3";
case HTML_TYPE_ADDRESS_LEVEL1:
return "HTML_TYPE_ADDRESS_LEVEL1";
case HTML_TYPE_ADDRESS_LEVEL2:
return "HTML_TYPE_ADDRESS_LEVEL2";
case HTML_TYPE_ADDRESS_LEVEL3:
return "HTML_TYPE_ADDRESS_LEVEL3";
case HTML_TYPE_COUNTRY_CODE:
return "HTML_TYPE_COUNTRY_CODE";
case HTML_TYPE_COUNTRY_NAME:
return "HTML_TYPE_COUNTRY_NAME";
case HTML_TYPE_POSTAL_CODE:
return "HTML_TYPE_POSTAL_CODE";
case HTML_TYPE_FULL_ADDRESS:
return "HTML_TYPE_FULL_ADDRESS";
case HTML_TYPE_CREDIT_CARD_NAME_FULL:
return "HTML_TYPE_CREDIT_CARD_NAME_FULL";
case HTML_TYPE_CREDIT_CARD_NAME_FIRST:
return "HTML_TYPE_CREDIT_CARD_NAME_FIRST";
case HTML_TYPE_CREDIT_CARD_NAME_LAST:
return "HTML_TYPE_CREDIT_CARD_NAME_LAST";
case HTML_TYPE_CREDIT_CARD_NUMBER:
return "HTML_TYPE_CREDIT_CARD_NUMBER";
case HTML_TYPE_CREDIT_CARD_EXP:
return "HTML_TYPE_CREDIT_CARD_EXP";
case HTML_TYPE_CREDIT_CARD_EXP_MONTH:
return "HTML_TYPE_CREDIT_CARD_EXP_MONTH";
case HTML_TYPE_CREDIT_CARD_EXP_YEAR:
return "HTML_TYPE_CREDIT_CARD_EXP_YEAR";
case HTML_TYPE_CREDIT_CARD_VERIFICATION_CODE:
return "HTML_TYPE_CREDIT_CARD_VERIFICATION_CODE";
case HTML_TYPE_CREDIT_CARD_TYPE:
return "HTML_TYPE_CREDIT_CARD_TYPE";
case HTML_TYPE_TEL:
return "HTML_TYPE_TEL";
case HTML_TYPE_TEL_COUNTRY_CODE:
return "HTML_TYPE_TEL_COUNTRY_CODE";
case HTML_TYPE_TEL_NATIONAL:
return "HTML_TYPE_TEL_NATIONAL";
case HTML_TYPE_TEL_AREA_CODE:
return "HTML_TYPE_TEL_AREA_CODE";
case HTML_TYPE_TEL_LOCAL:
return "HTML_TYPE_TEL_LOCAL";
case HTML_TYPE_TEL_LOCAL_PREFIX:
return "HTML_TYPE_TEL_LOCAL_PREFIX";
case HTML_TYPE_TEL_LOCAL_SUFFIX:
return "HTML_TYPE_TEL_LOCAL_SUFFIX";
case HTML_TYPE_TEL_EXTENSION:
return "HTML_TYPE_TEL_EXTENSION";
case HTML_TYPE_EMAIL:
return "HTML_TYPE_EMAIL";
case HTML_TYPE_ADDITIONAL_NAME_INITIAL:
return "HTML_TYPE_ADDITIONAL_NAME_INITIAL";
case HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR:
return "HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR";
case HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR:
return "HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR";
case HTML_TYPE_CREDIT_CARD_EXP_2_DIGIT_YEAR:
return "HTML_TYPE_CREDIT_CARD_EXP_2_DIGIT_YEAR";
case HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR:
return "HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR";
case HTML_TYPE_TRANSACTION_AMOUNT:
return "HTML_TRANSACTION_AMOUNT";
case HTML_TYPE_TRANSACTION_CURRENCY:
return "HTML_TRANSACTION_CURRENCY";
case HTML_TYPE_UPI_VPA:
return "HTML_TYPE_UPI_VPA";
}
NOTREACHED();
return std::string();
} }
// static // static
std::string AutofillType::ServerFieldTypeToString(ServerFieldType type) { std::string AutofillType::ServerFieldTypeToString(ServerFieldType type) {
// You are free to add or remove the String representation of ServerFieldType, return FieldTypeToStringPiece(type).as_string();
// but don't change any existing values, Android WebView presents them to
// Autofill Service as part of APIs.
switch (type) {
case NO_SERVER_DATA:
return "NO_SERVER_DATA";
case UNKNOWN_TYPE:
return "UNKNOWN_TYPE";
case EMPTY_TYPE:
return "EMPTY_TYPE";
case NAME_HONORIFIC_PREFIX:
return "NAME_HONORIFIC_PREFIX";
case NAME_FIRST:
return "NAME_FIRST";
case NAME_MIDDLE:
return "NAME_MIDDLE";
case NAME_LAST:
return "NAME_LAST";
case NAME_LAST_FIRST:
return "NAME_LAST_FIRST";
case NAME_LAST_CONJUNCTION:
return "NAME_LAST_CONJUNCTION";
case NAME_LAST_SECOND:
return "NAME_LAST_SECOND";
case NAME_MIDDLE_INITIAL:
return "NAME_MIDDLE_INITIAL";
case NAME_FULL:
return "NAME_FULL";
case NAME_SUFFIX:
return "NAME_SUFFIX";
case NAME_BILLING_FIRST:
return "NAME_BILLING_FIRST";
case NAME_BILLING_MIDDLE:
return "NAME_BILLING_MIDDLE";
case NAME_BILLING_LAST:
return "NAME_BILLING_LAST";
case NAME_BILLING_MIDDLE_INITIAL:
return "NAME_BILLING_MIDDLE_INITIAL";
case NAME_BILLING_FULL:
return "NAME_BILLING_FULL";
case NAME_BILLING_SUFFIX:
return "NAME_BILLING_SUFFIX";
case EMAIL_ADDRESS:
return "EMAIL_ADDRESS";
case PHONE_HOME_NUMBER:
return "PHONE_HOME_NUMBER";
case PHONE_HOME_CITY_CODE:
return "PHONE_HOME_CITY_CODE";
case PHONE_HOME_COUNTRY_CODE:
return "PHONE_HOME_COUNTRY_CODE";
case PHONE_HOME_CITY_AND_NUMBER:
return "PHONE_HOME_CITY_AND_NUMBER";
case PHONE_HOME_WHOLE_NUMBER:
return "PHONE_HOME_WHOLE_NUMBER";
case PHONE_HOME_EXTENSION:
return "PHONE_HOME_EXTENSION";
case PHONE_FAX_NUMBER:
return "PHONE_FAX_NUMBER";
case PHONE_FAX_CITY_CODE:
return "PHONE_FAX_CITY_CODE";
case PHONE_FAX_COUNTRY_CODE:
return "PHONE_FAX_COUNTRY_CODE";
case PHONE_FAX_CITY_AND_NUMBER:
return "PHONE_FAX_CITY_AND_NUMBER";
case PHONE_FAX_WHOLE_NUMBER:
return "PHONE_FAX_WHOLE_NUMBER";
case ADDRESS_HOME_LINE1:
return "ADDRESS_HOME_LINE1";
case ADDRESS_HOME_LINE2:
return "ADDRESS_HOME_LINE2";
case ADDRESS_HOME_LINE3:
return "ADDRESS_HOME_LINE3";
case ADDRESS_HOME_APT_NUM:
return "ADDRESS_HOME_APT_NUM";
case ADDRESS_HOME_CITY:
return "ADDRESS_HOME_CITY";
case ADDRESS_HOME_STATE:
return "ADDRESS_HOME_STATE";
case ADDRESS_HOME_ZIP:
return "ADDRESS_HOME_ZIP";
case ADDRESS_HOME_COUNTRY:
return "ADDRESS_HOME_COUNTRY";
case ADDRESS_BILLING_LINE1:
return "ADDRESS_BILLING_LINE1";
case ADDRESS_BILLING_LINE2:
return "ADDRESS_BILLING_LINE2";
case ADDRESS_BILLING_LINE3:
return "ADDRESS_BILLING_LINE3";
case ADDRESS_BILLING_APT_NUM:
return "ADDRESS_BILLING_APT_NUM";
case ADDRESS_BILLING_CITY:
return "ADDRESS_BILLING_CITY";
case ADDRESS_BILLING_STATE:
return "ADDRESS_BILLING_STATE";
case ADDRESS_BILLING_ZIP:
return "ADDRESS_BILLING_ZIP";
case ADDRESS_BILLING_COUNTRY:
return "ADDRESS_BILLING_COUNTRY";
case CREDIT_CARD_NAME_FULL:
return "CREDIT_CARD_NAME_FULL";
case CREDIT_CARD_NAME_FIRST:
return "CREDIT_CARD_NAME_FIRST";
case CREDIT_CARD_NAME_LAST:
return "CREDIT_CARD_NAME_LAST";
case CREDIT_CARD_NUMBER:
return "CREDIT_CARD_NUMBER";
case CREDIT_CARD_EXP_MONTH:
return "CREDIT_CARD_EXP_MONTH";
case CREDIT_CARD_EXP_2_DIGIT_YEAR:
return "CREDIT_CARD_EXP_2_DIGIT_YEAR";
case CREDIT_CARD_EXP_4_DIGIT_YEAR:
return "CREDIT_CARD_EXP_4_DIGIT_YEAR";
case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR:
return "CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR";
case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR:
return "CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR";
case CREDIT_CARD_TYPE:
return "CREDIT_CARD_TYPE";
case CREDIT_CARD_VERIFICATION_CODE:
return "CREDIT_CARD_VERIFICATION_CODE";
case COMPANY_NAME:
return "COMPANY_NAME";
case FIELD_WITH_DEFAULT_VALUE:
return "FIELD_WITH_DEFAULT_VALUE";
case PHONE_BILLING_NUMBER:
return "PHONE_BILLING_NUMBER";
case PHONE_BILLING_CITY_CODE:
return "PHONE_BILLING_CITY_CODE";
case PHONE_BILLING_COUNTRY_CODE:
return "PHONE_BILLING_COUNTRY_CODE";
case PHONE_BILLING_CITY_AND_NUMBER:
return "PHONE_BILLING_CITY_AND_NUMBER";
case PHONE_BILLING_WHOLE_NUMBER:
return "PHONE_BILLING_WHOLE_NUMBER";
case MERCHANT_EMAIL_SIGNUP:
return "MERCHANT_EMAIL_SIGNUP";
case MERCHANT_PROMO_CODE:
return "MERCHANT_PROMO_CODE";
case PASSWORD:
return "PASSWORD";
case ACCOUNT_CREATION_PASSWORD:
return "ACCOUNT_CREATION_PASSWORD";
case ADDRESS_HOME_STREET_ADDRESS:
return "ADDRESS_HOME_STREET_ADDRESS";
case ADDRESS_BILLING_STREET_ADDRESS:
return "ADDRESS_BILLING_STREET_ADDRESS";
case ADDRESS_HOME_SORTING_CODE:
return "ADDRESS_HOME_SORTING_CODE";
case ADDRESS_BILLING_SORTING_CODE:
return "ADDRESS_BILLING_SORTING_CODE";
case ADDRESS_HOME_DEPENDENT_LOCALITY:
return "ADDRESS_HOME_DEPENDENT_LOCALITY";
case ADDRESS_BILLING_DEPENDENT_LOCALITY:
return "ADDRESS_BILLING_DEPENDENT_LOCALITY";
case NOT_ACCOUNT_CREATION_PASSWORD:
return "NOT_ACCOUNT_CREATION_PASSWORD";
case USERNAME:
return "USERNAME";
case USERNAME_AND_EMAIL_ADDRESS:
return "USERNAME_AND_EMAIL_ADDRESS";
case NEW_PASSWORD:
return "NEW_PASSWORD";
case PROBABLY_NEW_PASSWORD:
return "PROBABLY_NEW_PASSWORD";
case NOT_NEW_PASSWORD:
return "NOT_NEW_PASSWORD";
case CONFIRMATION_PASSWORD:
return "CONFIRMATION_PASSWORD";
case SEARCH_TERM:
return "SEARCH_TERM";
case PRICE:
return "PRICE";
case NOT_PASSWORD:
return "NOT_PASSWORD";
case SINGLE_USERNAME:
return "SINGLE_USERNAME";
case NOT_USERNAME:
return "NOT_USERNAME";
case UPI_VPA:
return "UPI_VPA";
case ADDRESS_HOME_STREET:
return "ADDRESS_HOME_STREET";
case ADDRESS_HOME_HOUSE_NUMBER:
return "ADDRESS_HOME_HOUSE_NUMBER";
case ADDRESS_HOME_FLOOR:
return "ADDRESS_HOME_FLOOR";
case ADDRESS_HOME_OTHER_SUBUNIT:
return "ADDRESS_HOME_OTHER_SUBUNIT";
case AMBIGUOUS_TYPE:
return "AMBIGUOUS_TYPE";
case MAX_VALID_FIELD_TYPE:
return std::string();
}
NOTREACHED();
return std::string();
} }
} // namespace autofill } // namespace autofill
...@@ -133,6 +133,205 @@ bool IsFillableFieldType(ServerFieldType field_type) { ...@@ -133,6 +133,205 @@ bool IsFillableFieldType(ServerFieldType field_type) {
return false; return false;
} }
base::StringPiece FieldTypeToStringPiece(ServerFieldType type) {
// You are free to add or remove the String representation of ServerFieldType,
// but don't change any existing values, Android WebView presents them to
// Autofill Service as part of APIs.
switch (type) {
case NO_SERVER_DATA:
return "NO_SERVER_DATA";
case UNKNOWN_TYPE:
return "UNKNOWN_TYPE";
case EMPTY_TYPE:
return "EMPTY_TYPE";
case NAME_HONORIFIC_PREFIX:
return "NAME_HONORIFIC_PREFIX";
case NAME_FIRST:
return "NAME_FIRST";
case NAME_MIDDLE:
return "NAME_MIDDLE";
case NAME_LAST:
return "NAME_LAST";
case NAME_LAST_FIRST:
return "NAME_LAST_FIRST";
case NAME_LAST_CONJUNCTION:
return "NAME_LAST_CONJUNCTION";
case NAME_LAST_SECOND:
return "NAME_LAST_SECOND";
case NAME_MIDDLE_INITIAL:
return "NAME_MIDDLE_INITIAL";
case NAME_FULL:
return "NAME_FULL";
case NAME_SUFFIX:
return "NAME_SUFFIX";
case NAME_BILLING_FIRST:
return "NAME_BILLING_FIRST";
case NAME_BILLING_MIDDLE:
return "NAME_BILLING_MIDDLE";
case NAME_BILLING_LAST:
return "NAME_BILLING_LAST";
case NAME_BILLING_MIDDLE_INITIAL:
return "NAME_BILLING_MIDDLE_INITIAL";
case NAME_BILLING_FULL:
return "NAME_BILLING_FULL";
case NAME_BILLING_SUFFIX:
return "NAME_BILLING_SUFFIX";
case EMAIL_ADDRESS:
return "EMAIL_ADDRESS";
case PHONE_HOME_NUMBER:
return "PHONE_HOME_NUMBER";
case PHONE_HOME_CITY_CODE:
return "PHONE_HOME_CITY_CODE";
case PHONE_HOME_COUNTRY_CODE:
return "PHONE_HOME_COUNTRY_CODE";
case PHONE_HOME_CITY_AND_NUMBER:
return "PHONE_HOME_CITY_AND_NUMBER";
case PHONE_HOME_WHOLE_NUMBER:
return "PHONE_HOME_WHOLE_NUMBER";
case PHONE_HOME_EXTENSION:
return "PHONE_HOME_EXTENSION";
case PHONE_FAX_NUMBER:
return "PHONE_FAX_NUMBER";
case PHONE_FAX_CITY_CODE:
return "PHONE_FAX_CITY_CODE";
case PHONE_FAX_COUNTRY_CODE:
return "PHONE_FAX_COUNTRY_CODE";
case PHONE_FAX_CITY_AND_NUMBER:
return "PHONE_FAX_CITY_AND_NUMBER";
case PHONE_FAX_WHOLE_NUMBER:
return "PHONE_FAX_WHOLE_NUMBER";
case ADDRESS_HOME_LINE1:
return "ADDRESS_HOME_LINE1";
case ADDRESS_HOME_LINE2:
return "ADDRESS_HOME_LINE2";
case ADDRESS_HOME_LINE3:
return "ADDRESS_HOME_LINE3";
case ADDRESS_HOME_APT_NUM:
return "ADDRESS_HOME_APT_NUM";
case ADDRESS_HOME_CITY:
return "ADDRESS_HOME_CITY";
case ADDRESS_HOME_STATE:
return "ADDRESS_HOME_STATE";
case ADDRESS_HOME_ZIP:
return "ADDRESS_HOME_ZIP";
case ADDRESS_HOME_COUNTRY:
return "ADDRESS_HOME_COUNTRY";
case ADDRESS_BILLING_LINE1:
return "ADDRESS_BILLING_LINE1";
case ADDRESS_BILLING_LINE2:
return "ADDRESS_BILLING_LINE2";
case ADDRESS_BILLING_LINE3:
return "ADDRESS_BILLING_LINE3";
case ADDRESS_BILLING_APT_NUM:
return "ADDRESS_BILLING_APT_NUM";
case ADDRESS_BILLING_CITY:
return "ADDRESS_BILLING_CITY";
case ADDRESS_BILLING_STATE:
return "ADDRESS_BILLING_STATE";
case ADDRESS_BILLING_ZIP:
return "ADDRESS_BILLING_ZIP";
case ADDRESS_BILLING_COUNTRY:
return "ADDRESS_BILLING_COUNTRY";
case CREDIT_CARD_NAME_FULL:
return "CREDIT_CARD_NAME_FULL";
case CREDIT_CARD_NAME_FIRST:
return "CREDIT_CARD_NAME_FIRST";
case CREDIT_CARD_NAME_LAST:
return "CREDIT_CARD_NAME_LAST";
case CREDIT_CARD_NUMBER:
return "CREDIT_CARD_NUMBER";
case CREDIT_CARD_EXP_MONTH:
return "CREDIT_CARD_EXP_MONTH";
case CREDIT_CARD_EXP_2_DIGIT_YEAR:
return "CREDIT_CARD_EXP_2_DIGIT_YEAR";
case CREDIT_CARD_EXP_4_DIGIT_YEAR:
return "CREDIT_CARD_EXP_4_DIGIT_YEAR";
case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR:
return "CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR";
case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR:
return "CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR";
case CREDIT_CARD_TYPE:
return "CREDIT_CARD_TYPE";
case CREDIT_CARD_VERIFICATION_CODE:
return "CREDIT_CARD_VERIFICATION_CODE";
case COMPANY_NAME:
return "COMPANY_NAME";
case FIELD_WITH_DEFAULT_VALUE:
return "FIELD_WITH_DEFAULT_VALUE";
case PHONE_BILLING_NUMBER:
return "PHONE_BILLING_NUMBER";
case PHONE_BILLING_CITY_CODE:
return "PHONE_BILLING_CITY_CODE";
case PHONE_BILLING_COUNTRY_CODE:
return "PHONE_BILLING_COUNTRY_CODE";
case PHONE_BILLING_CITY_AND_NUMBER:
return "PHONE_BILLING_CITY_AND_NUMBER";
case PHONE_BILLING_WHOLE_NUMBER:
return "PHONE_BILLING_WHOLE_NUMBER";
case MERCHANT_EMAIL_SIGNUP:
return "MERCHANT_EMAIL_SIGNUP";
case MERCHANT_PROMO_CODE:
return "MERCHANT_PROMO_CODE";
case PASSWORD:
return "PASSWORD";
case ACCOUNT_CREATION_PASSWORD:
return "ACCOUNT_CREATION_PASSWORD";
case ADDRESS_HOME_STREET_ADDRESS:
return "ADDRESS_HOME_STREET_ADDRESS";
case ADDRESS_BILLING_STREET_ADDRESS:
return "ADDRESS_BILLING_STREET_ADDRESS";
case ADDRESS_HOME_SORTING_CODE:
return "ADDRESS_HOME_SORTING_CODE";
case ADDRESS_BILLING_SORTING_CODE:
return "ADDRESS_BILLING_SORTING_CODE";
case ADDRESS_HOME_DEPENDENT_LOCALITY:
return "ADDRESS_HOME_DEPENDENT_LOCALITY";
case ADDRESS_BILLING_DEPENDENT_LOCALITY:
return "ADDRESS_BILLING_DEPENDENT_LOCALITY";
case NOT_ACCOUNT_CREATION_PASSWORD:
return "NOT_ACCOUNT_CREATION_PASSWORD";
case USERNAME:
return "USERNAME";
case USERNAME_AND_EMAIL_ADDRESS:
return "USERNAME_AND_EMAIL_ADDRESS";
case NEW_PASSWORD:
return "NEW_PASSWORD";
case PROBABLY_NEW_PASSWORD:
return "PROBABLY_NEW_PASSWORD";
case NOT_NEW_PASSWORD:
return "NOT_NEW_PASSWORD";
case CONFIRMATION_PASSWORD:
return "CONFIRMATION_PASSWORD";
case SEARCH_TERM:
return "SEARCH_TERM";
case PRICE:
return "PRICE";
case NOT_PASSWORD:
return "NOT_PASSWORD";
case SINGLE_USERNAME:
return "SINGLE_USERNAME";
case NOT_USERNAME:
return "NOT_USERNAME";
case UPI_VPA:
return "UPI_VPA";
case ADDRESS_HOME_STREET:
return "ADDRESS_HOME_STREET";
case ADDRESS_HOME_HOUSE_NUMBER:
return "ADDRESS_HOME_HOUSE_NUMBER";
case ADDRESS_HOME_FLOOR:
return "ADDRESS_HOME_FLOOR";
case ADDRESS_HOME_OTHER_SUBUNIT:
return "ADDRESS_HOME_OTHER_SUBUNIT";
case AMBIGUOUS_TYPE:
return "AMBIGUOUS_TYPE";
case MAX_VALID_FIELD_TYPE:
return "";
}
NOTREACHED();
return "";
}
base::StringPiece FieldTypeToStringPiece(HtmlFieldType type) { base::StringPiece FieldTypeToStringPiece(HtmlFieldType type) {
switch (type) { switch (type) {
case HTML_TYPE_UNSPECIFIED: case HTML_TYPE_UNSPECIFIED:
...@@ -226,6 +425,7 @@ base::StringPiece FieldTypeToStringPiece(HtmlFieldType type) { ...@@ -226,6 +425,7 @@ base::StringPiece FieldTypeToStringPiece(HtmlFieldType type) {
case HTML_TYPE_UNRECOGNIZED: case HTML_TYPE_UNRECOGNIZED:
return "HTML_TYPE_UNRECOGNIZED"; return "HTML_TYPE_UNRECOGNIZED";
} }
NOTREACHED(); NOTREACHED();
return ""; return "";
} }
......
...@@ -327,6 +327,10 @@ bool IsFillableFieldType(ServerFieldType field_type); ...@@ -327,6 +327,10 @@ bool IsFillableFieldType(ServerFieldType field_type);
// Returns a StringPiece describing |type|. As the StringPiece points to a // Returns a StringPiece describing |type|. As the StringPiece points to a
// static string, you don't need to worry about memory deallocation. // static string, you don't need to worry about memory deallocation.
base::StringPiece FieldTypeToStringPiece(HtmlFieldType type); base::StringPiece FieldTypeToStringPiece(HtmlFieldType type);
// Returns a StringPiece describing |type|. As the StringPiece points to a
// static string, you don't need to worry about memory deallocation.
base::StringPiece FieldTypeToStringPiece(ServerFieldType type);
} // namespace autofill } // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_ #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment