Commit 390834e5 authored by Vidhan Jain's avatar Vidhan Jain Committed by Chromium LUCI CQ

[iOS][Autofill] Add honorific prefix field

This CL adds an input field for the honorific prefixes above the
"Full Name" field, accessible from the Autofill Settings View.
The field is visible only when the
kAutofillEnableUIForHonorificPrefixesInSettings feature is enabled.

The entered value will not be saved, because honorifics are temporarily
disabled (crbug/1113617).

Screenshot: https://storage.cloud.google.com/chromium-translation-screenshots/aa5e881149c5eb8c425711c2f3cabad33a45c35e?authuser=0

Bug: 1141884
Change-Id: I353d3b65b96e3960bbf950455da049e0292477a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594749Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarViktor Semeniuk <vsemeniuk@google.com>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Vidhan Jain <vidhanj@google.com>
Cr-Commit-Position: refs/heads/master@{#840122}
parent 892421f1
......@@ -330,6 +330,9 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_AUTOFILL_SAVE_CARD_BADGE_HINT" desc="Accessibility Hint for the Save Card button which presents the current options to Save a Card. This is spoken by VoiceOver. [Length:Unlimited] [iOS only]">
Options to Save Card
</message>
<message name="IDS_IOS_AUTOFILL_HONORIFIC_PREFIX" desc="Title of the field of a profile address representing the title that can be auto-filled by Chrome. [iOS only]" meaning="A 'Title' field in a web form could be a prefix like Ms., Mx., or Dr. or a position held, like Captain or Rabbi. [Length: 15em]">
Title
</message>
<message name="IDS_IOS_AUTOFILL_FULLNAME" desc="Title of the field of a profile address representing the full name of the addressee. [Length: 15em] [iOS only]">
Full Name
</message>
......
......@@ -20,6 +20,7 @@ typedef NS_ENUM(NSInteger, AutofillUIType) {
AutofillUITypeCreditCardExpDate,
AutofillUITypeCreditCardBillingAddress,
AutofillUITypeCreditCardSaveToChrome,
AutofillUITypeProfileHonorificPrefix,
AutofillUITypeProfileFullName,
AutofillUITypeProfileCompanyName,
AutofillUITypeProfileHomeAddressStreet,
......
......@@ -22,6 +22,8 @@ AutofillUIType AutofillUITypeFromAutofillType(autofill::ServerFieldType type) {
return AutofillUITypeCreditCardExpMonth;
case autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR:
return AutofillUITypeCreditCardExpYear;
case autofill::NAME_HONORIFIC_PREFIX:
return AutofillUITypeProfileHonorificPrefix;
case autofill::NAME_FULL:
return AutofillUITypeProfileFullName;
case autofill::COMPANY_NAME:
......@@ -66,6 +68,8 @@ autofill::ServerFieldType AutofillTypeFromAutofillUIType(AutofillUIType type) {
return autofill::CREDIT_CARD_EXP_MONTH;
case AutofillUITypeCreditCardExpYear:
return autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR;
case AutofillUITypeProfileHonorificPrefix:
return autofill::NAME_HONORIFIC_PREFIX;
case AutofillUITypeProfileFullName:
return autofill::NAME_FULL;
case AutofillUITypeProfileCompanyName:
......
......@@ -52,6 +52,9 @@ struct AutofillFieldDisplayInfo {
};
static const AutofillFieldDisplayInfo kFieldsToDisplay[] = {
{autofill::NAME_HONORIFIC_PREFIX, IDS_IOS_AUTOFILL_HONORIFIC_PREFIX,
UIReturnKeyNext, UIKeyboardTypeDefault,
UITextAutocapitalizationTypeSentences},
{autofill::NAME_FULL, IDS_IOS_AUTOFILL_FULLNAME, UIReturnKeyNext,
UIKeyboardTypeDefault, UITextAutocapitalizationTypeSentences},
{autofill::COMPANY_NAME, IDS_IOS_AUTOFILL_COMPANY_NAME, UIReturnKeyNext,
......@@ -187,6 +190,13 @@ static const AutofillFieldDisplayInfo kFieldsToDisplay[] = {
for (size_t i = 0; i < base::size(kFieldsToDisplay); ++i) {
const AutofillFieldDisplayInfo& field = kFieldsToDisplay[i];
if (field.autofillType == autofill::NAME_HONORIFIC_PREFIX &&
!base::FeatureList::IsEnabled(
autofill::features::
kAutofillEnableUIForHonorificPrefixesInSettings)) {
continue;
}
AutofillEditItem* item =
[[AutofillEditItem alloc] initWithType:ItemTypeField];
item.textFieldName = l10n_util::GetNSString(field.displayStringID);
......
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