Commit 391ebba5 authored by sczs's avatar sczs Committed by Commit Bot

Creates feature flag for Save Card Infobar editing.

It also enables editing on the SaveCardModal if the flag is enabled
and the card will be uploaded.

Bug: 1029067
Change-Id: If8dd3c0ab5e2ef9e4b943a7ae3bf2347f2c47130
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947766
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/master@{#721900}
parent 9bf5ea4b
......@@ -73,6 +73,10 @@ const base::Feature kAutofillNoLocalSaveOnUploadSuccess{
const base::Feature kAutofillSaveCardDismissOnNavigation{
"AutofillSaveCardDismissOnNavigation", base::FEATURE_ENABLED_BY_DEFAULT};
// When enabled, the Save Card infobar supports editing before submitting.
const base::Feature kAutofillSaveCardInfobarEditSupport{
"AutofillSaveCardInfobarEditSupport", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls offering credit card upload to Google Payments. Cannot ever be
// ENABLED_BY_DEFAULT because it's a country-specific whitelist. There are
// countries we simply can't turn this on for, and they change over time, so
......
......@@ -29,6 +29,7 @@ extern const base::Feature kAutofillEnableVirtualCard;
extern const base::Feature kAutofillNoLocalSaveOnUnmaskSuccess;
extern const base::Feature kAutofillNoLocalSaveOnUploadSuccess;
extern const base::Feature kAutofillSaveCardDismissOnNavigation;
extern const base::Feature kAutofillSaveCardInfobarEditSupport;
extern const base::Feature kAutofillUpstream;
extern const base::Feature kAutofillUpstreamAllowAllEmailDomains;
extern const base::Feature kAutofillUpstreamAlwaysRequestCardholderName;
......
......@@ -592,6 +592,12 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
{"infobar-overlay-ui", flag_descriptions::kInfobarOverlayUIName,
flag_descriptions::kInfobarOverlayUIDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kInfobarOverlayUI)},
{"autofill-save-card-infobar-edit-support",
flag_descriptions::kAutofillSaveCardInfobarEditSupportName,
flag_descriptions::kAutofillSaveCardInfobarEditSupportDescription,
flags_ui::kOsIos,
FEATURE_VALUE_TYPE(
autofill::features::kAutofillSaveCardInfobarEditSupport)},
};
// Add all switches from experimental flags to |command_line|.
......
......@@ -74,6 +74,12 @@ const char kAutofillSaveCardDismissOnNavigationDescription[] =
"Dismisses the Save Card Infobar on a user initiated Navigation, other "
"than one caused by submitted form.";
const char kAutofillSaveCardInfobarEditSupportName[] =
"Save Card Infobar Edit Support";
const char kAutofillSaveCardInfobarEditSupportDescription[] =
"When enabled and saving a credit card to Google Payments, a dialog is "
"displayed that allows editing the card info before confirming save.";
const char kAutofillShowAllSuggestionsOnPrefilledFormsName[] =
"Enable showing all suggestions when focusing prefilled field";
const char kAutofillShowAllSuggestionsOnPrefilledFormsDescription[] =
......
......@@ -53,6 +53,11 @@ extern const char kAutofillPruneSuggestionsDescription[];
extern const char kAutofillSaveCardDismissOnNavigationName[];
extern const char kAutofillSaveCardDismissOnNavigationDescription[];
// Title and description for the flag that enables editing on the Messages UI
// for SaveCard Infobars.
extern const char kAutofillSaveCardInfobarEditSupportName[];
extern const char kAutofillSaveCardInfobarEditSupportDescription[];
// Title and description for the flag to control if prefilled value filter
// profiles.
extern const char kAutofillShowAllSuggestionsOnPrefilledFormsName[];
......
......@@ -6,6 +6,7 @@
#include "base/strings/sys_string_conversions.h"
#include "components/autofill/core/browser/payments/autofill_save_card_infobar_delegate_mobile.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "ios/chrome/browser/infobars/infobar_controller_delegate.h"
#import "ios/chrome/browser/infobars/infobar_type.h"
#import "ios/chrome/browser/ui/autofill/save_card_message_with_links.h"
......@@ -166,9 +167,13 @@
self.saveCardInfoBarDelegate->expiration_date_year());
self.modalViewController.currentCardSaved = !self.infobarAccepted;
self.modalViewController.legalMessages = [self legalMessagesForModal];
// TODO(crbug.com/1029067):Change NO to
// self.saveCardInfoBarDelegate->upload(). Once we want to enable editing.
self.modalViewController.supportsEditing = NO;
if ((base::FeatureList::IsEnabled(
autofill::features::kAutofillSaveCardInfobarEditSupport))) {
self.modalViewController.supportsEditing =
self.saveCardInfoBarDelegate->upload();
} else {
self.modalViewController.supportsEditing = NO;
}
return YES;
}
......
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