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

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: 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
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..903f8bf561c88a4be6c93e6cf7e45433a3c3203a 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,11 @@ void AutofillSaveCardInfoBarDelegateMobile::OnLegalMessageLinkClicked(
infobar()->owner()->OpenURL(url, WindowOpenDisposition::NEW_FOREGROUND_TAB);
}
+bool AutofillSaveCardInfoBarDelegateMobile::LegalMessagesParsedSuccessfully() {
+ // If upload save and legal_messages_ is empty then fail, else succeed.
Mathieu 2017/06/20 00:36:20 nit: If we are uploading to the server, verify tha
Jared Saul 2017/06/20 20:51:27 Done, thanks!
+ return !upload_ || !legal_messages_.empty();
+}
+
int AutofillSaveCardInfoBarDelegateMobile::GetIconId() const {
return IDR_INFOBAR_AUTOFILL_CC;
}

Powered by Google App Engine
This is Rietveld 408576698