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

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

Issue 2945563003: AutofillSaveCardInfoBar on mobile should not appear when legal messages don't parse correctly (Closed)
Patch Set: Code review changes Created 3 years, 6 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/autofill_save_card_infobar_delegate_mobile.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc
diff --git a/components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc b/components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc
index 626743179ee48919b060db283e610d8e95de28b4..d28102a4002d42d5726c43b3625c98043fa7cc5a 100644
--- a/components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc
+++ b/components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc
@@ -43,8 +43,15 @@ AutofillSaveCardInfoBarDelegateMobile::AutofillSaveCardInfoBarDelegateMobile(
#endif
card_label_(base::string16(kMidlineEllipsis) + card.LastFourDigits()),
card_sub_label_(card.AbbreviatedExpirationDateForDisplay()) {
- if (legal_message)
- LegalMessageLine::Parse(*legal_message, &legal_messages_);
+ if (legal_message) {
+ if (!LegalMessageLine::Parse(*legal_message, &legal_messages_)) {
+ AutofillMetrics::LogCreditCardInfoBarMetric(
+ AutofillMetrics::INFOBAR_NOT_SHOWN_INVALID_LEGAL_MESSAGE, upload_,
+ pref_service_->GetInteger(
+ prefs::kAutofillAcceptSaveCreditCardPromptState));
+ return;
+ }
+ }
AutofillMetrics::LogCreditCardInfoBarMetric(
AutofillMetrics::INFOBAR_SHOWN, upload_,
@@ -63,6 +70,12 @@ void AutofillSaveCardInfoBarDelegateMobile::OnLegalMessageLinkClicked(
infobar()->owner()->OpenURL(url, WindowOpenDisposition::NEW_FOREGROUND_TAB);
}
+bool AutofillSaveCardInfoBarDelegateMobile::LegalMessagesParsedSuccessfully() {
+ // If we are uploading to the server, verify that legal lines have been parsed
+ // into |legal_messages_|.
+ return !upload_ || !legal_messages_.empty();
+}
+
int AutofillSaveCardInfoBarDelegateMobile::GetIconId() const {
return IDR_INFOBAR_AUTOFILL_CC;
}
« no previous file with comments | « components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698