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

[Autofill][Slimshady] Structured address tokens for ProfileSpecifics

This CL adds the new tokens for addresses and validation statuses
for more structured addresses and names to the AutofillProfileSpecifics.

Change-Id: If1c05447703f08b65a203208953b314f5f35a256
Bug: 1099202
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321308
Commit-Queue: Matthias Körber <koerber@google.com>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793610}
parent e1e07d1c
......@@ -17,17 +17,18 @@
namespace autofill {
namespace structured_address {
// Represents the validation status of value stored in the AutofillProfile.
enum class VerificationStatus {
// No verification status assigned.
kNoStatus,
// The user used the autofill settings to verify and store this token.
kUserVerified,
// The value was observed in a form transmission.
kObserved,
// Value was built from its subcomponents.
kFormatted,
// The value token was parsed from a parent token.
kParsed,
// Value was built from its subcomponents.
kFormatted,
// The value was observed in a form transmission.
kObserved,
// The user used the autofill settings to verify and store this token.
kUserVerified,
};
// An AddressComponent is a tree structure that represents a semi-structured
......
......@@ -20,6 +20,28 @@ package sync_pb;
// An AutofillProfile.
message AutofillProfileSpecifics {
// Represents the validation status of value stored in the AutofillProfile.
enum VerificationStatus {
// No verification status assigned.
VERIFICATION_STATUS_UNSPECIFIED = 0;
// The value token was parsed from a parent token.
// For example, the first name was derived by splitting a full name into
// its components.
PARSED = 1;
// Value was built from its subcomponents.
// For example, the full name was built from the first, middle and last
// name.
FORMATTED = 2;
// The value was observed in a form transmission.
// For example, the user filled a form that contained at NAME_FULL field.
// The value of NAME_FULL will be stored as OBSERVED.
OBSERVED = 3;
// The user used the autofill settings to verify and store this token.
// This is currently only applicable to the full name, since users cannot
// edit individual components of their name.
USER_VERIFIED = 4;
}
optional string guid = 15;
optional string origin = 16;
optional int64 use_count = 22;
......@@ -29,15 +51,44 @@ message AutofillProfileSpecifics {
// from the Windows epoch.
optional int64 use_date = 23;
// Contact info.
// Contact info name fields.
repeated string name_honorific = 26;
repeated string name_first = 2;
repeated string name_middle = 3;
repeated string name_last = 4;
// Sometimes the last name is composed of two names as it is common for
// Hispanic/Latinx names. In the unstructured representation of the last name,
// there may be even a conjunction between the first and the second last
// name. For example, the more-complete version of Pablo Picasso's surname is
// "Ruiz y Picasso" containing a first last name, a conjunction (the y) and a
// second last name.
repeated string name_last_first = 27;
repeated string name_last_conjuction = 28;
repeated string name_last_second = 29;
repeated string name_full = 21;
// Validation status records for name fields.
repeated VerificationStatus name_honorific_status = 30;
repeated VerificationStatus name_first_status = 31;
repeated VerificationStatus name_middle_status = 32;
repeated VerificationStatus name_last_status = 33;
repeated VerificationStatus name_last_first_status = 34;
repeated VerificationStatus name_last_conjuction_status = 35;
repeated VerificationStatus name_last_second_status = 36;
repeated VerificationStatus name_full_status = 37;
// Contact info additional fields.
repeated string email_address = 5;
optional string company_name = 6;
// Address.
// Address field.
// The address_home_line1/2 fields are deprecated and
// address_home_street_address should be used instead by
// joining address_home_line1/2 with a newline ("\n").
// Full deprecation can not be achieved before all sync profiles have been
// updated with a M86+ client.
// TODO(crbug/1111740): Remove usages of address_home_line1/2 and mark field
// as deprecated.
optional string address_home_line1 = 7;
optional string address_home_line2 = 8;
optional string address_home_city = 9;
......@@ -50,6 +101,27 @@ message AutofillProfileSpecifics {
optional string address_home_sorting_code = 18;
optional string address_home_dependent_locality = 19;
optional string address_home_language_code = 20;
optional string address_home_thoroughfare_name = 38;
optional string address_home_thoroughfare_number = 39;
optional string address_home_dependent_thoroughfare_name = 40;
optional string address_home_premise_name = 41;
optional string address_home_subpremise_name = 42;
// Validation status records for address fields.
optional VerificationStatus address_home_city_status = 43;
optional VerificationStatus address_home_state_status = 44;
optional VerificationStatus address_home_zip_status = 45;
optional VerificationStatus address_home_country_status = 46;
optional VerificationStatus address_home_street_address_status = 47;
optional VerificationStatus address_home_sorting_code_status = 48;
optional VerificationStatus address_home_dependent_locality_status = 49;
optional VerificationStatus address_home_language_code_status = 50;
optional VerificationStatus address_home_thoroughfare_name_status = 51;
optional VerificationStatus address_home_thoroughfare_number_status = 52;
optional VerificationStatus address_home_dependent_thoroughfare_name_status =
53;
optional VerificationStatus address_home_premise_name_status = 54;
optional VerificationStatus address_home_subpremise_name_status = 55;
// Phone.
repeated string phone_home_whole_number = 13;
......
......@@ -46,6 +46,22 @@ const char* ProtoEnumToString(sync_pb::AppSpecifics::LaunchType launch_type) {
return "";
}
const char* ProtoEnumToString(
sync_pb::AutofillProfileSpecifics::VerificationStatus status) {
ASSERT_ENUM_BOUNDS(sync_pb::AutofillProfileSpecifics, VerificationStatus,
VERIFICATION_STATUS_UNSPECIFIED, USER_VERIFIED);
switch (status) {
ENUM_CASE(sync_pb::AutofillProfileSpecifics,
VERIFICATION_STATUS_UNSPECIFIED);
ENUM_CASE(sync_pb::AutofillProfileSpecifics, PARSED);
ENUM_CASE(sync_pb::AutofillProfileSpecifics, FORMATTED);
ENUM_CASE(sync_pb::AutofillProfileSpecifics, OBSERVED);
ENUM_CASE(sync_pb::AutofillProfileSpecifics, USER_VERIFIED);
}
NOTREACHED();
return "";
}
const char* ProtoEnumToString(
sync_pb::AutofillWalletSpecifics::WalletInfoType wallet_info_type) {
ASSERT_ENUM_BOUNDS(sync_pb::AutofillWalletSpecifics, WalletInfoType, UNKNOWN,
......
......@@ -107,6 +107,9 @@ const char* ProtoEnumToString(
const char* ProtoEnumToString(
sync_pb::WebAppSpecifics::UserDisplayMode user_display_mode);
const char* ProtoEnumToString(
sync_pb::AutofillProfileSpecifics::VerificationStatus status);
const char* ProtoEnumToString(
sync_pb::WifiConfigurationSpecifics::SecurityType security_type);
......
......@@ -141,12 +141,27 @@ VISIT_PROTO_FIELDS(const sync_pb::AutofillProfileSpecifics& proto) {
VISIT(origin);
VISIT(use_count);
VISIT(use_date);
VISIT_REP(name_honorific);
VISIT_REP(name_first);
VISIT_REP(name_middle);
VISIT_REP(name_last_first);
VISIT_REP(name_last_conjuction);
VISIT_REP(name_last_second);
VISIT_REP(name_last);
VISIT_REP(name_full);
VISIT_REP(name_honorific_status);
VISIT_REP(name_first_status);
VISIT_REP(name_middle_status);
VISIT_REP(name_last_first_status);
VISIT_REP(name_last_conjuction_status);
VISIT_REP(name_last_second_status);
VISIT_REP(name_last_status);
VISIT_REP(name_full_status);
VISIT_REP(email_address);
VISIT(company_name);
VISIT(address_home_line1);
VISIT(address_home_line2);
VISIT(address_home_city);
......@@ -156,6 +171,25 @@ VISIT_PROTO_FIELDS(const sync_pb::AutofillProfileSpecifics& proto) {
VISIT(address_home_street_address);
VISIT(address_home_sorting_code);
VISIT(address_home_dependent_locality);
VISIT(address_home_thoroughfare_name);
VISIT(address_home_thoroughfare_number);
VISIT(address_home_dependent_thoroughfare_name);
VISIT(address_home_premise_name);
VISIT(address_home_subpremise_name);
VISIT_ENUM(address_home_city_status);
VISIT_ENUM(address_home_state_status);
VISIT_ENUM(address_home_zip_status);
VISIT_ENUM(address_home_country_status);
VISIT_ENUM(address_home_street_address_status);
VISIT_ENUM(address_home_sorting_code_status);
VISIT_ENUM(address_home_dependent_locality_status);
VISIT_ENUM(address_home_thoroughfare_name_status);
VISIT_ENUM(address_home_thoroughfare_number_status);
VISIT_ENUM(address_home_dependent_thoroughfare_name_status);
VISIT_ENUM(address_home_premise_name_status);
VISIT_ENUM(address_home_subpremise_name_status);
VISIT(address_home_language_code);
VISIT_REP(phone_home_whole_number);
VISIT(validity_state_bitfield);
......
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