[Autofill Offers] Updating text for cards with offers.

Text now includes "Cashback linked" instead of including
the percentage or dollar amount.

(cherry picked from commit 20de10a837134d37880918a2bb7156cf30717bad)

Bug: 1138158
Change-Id: I53e046a6a495cc4b6cabbf35a8876e940f280b49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2466142
Commit-Queue: Manas Verma <[email protected]>
Reviewed-by: Siyu An <[email protected]>
Reviewed-by: Jared Saul <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#816903}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2476912
Reviewed-by: Manas Verma <[email protected]>
Cr-Commit-Position: refs/branch-heads/4280@{#432}
Cr-Branched-From: ea420fb963f9658c9969b6513c56b8f47efa1a2a-refs/heads/master@{#812852}
diff --git a/components/autofill/core/browser/payments/autofill_offer_manager.cc b/components/autofill/core/browser/payments/autofill_offer_manager.cc
index c418886..0dbee44 100644
--- a/components/autofill/core/browser/payments/autofill_offer_manager.cc
+++ b/components/autofill/core/browser/payments/autofill_offer_manager.cc
@@ -62,14 +62,8 @@
   for (auto& suggestion : suggestions) {
     std::string id = suggestion.backend_id;
     if (eligible_offers_map.count(id)) {
-      base::string16 reward_amount =
-          base::UTF8ToUTF16(eligible_offers_map[id]->offer_reward_amount);
-
-      auto string_id = (reward_amount.find('%') == std::string::npos)
-                           ? IDS_AUTOFILL_OFFERS_DISCOUNT
-                           : IDS_AUTOFILL_OFFERS_CASHBACK;
       suggestion.offer_label =
-          l10n_util::GetStringFUTF16(string_id, reward_amount);
+          l10n_util::GetStringUTF16(IDS_AUTOFILL_OFFERS_CASHBACK);
     }
   }
 }
diff --git a/components/autofill/core/browser/payments/autofill_offer_manager_unittest.cc b/components/autofill/core/browser/payments/autofill_offer_manager_unittest.cc
index 802136d..85f7277 100644
--- a/components/autofill/core/browser/payments/autofill_offer_manager_unittest.cc
+++ b/components/autofill/core/browser/payments/autofill_offer_manager_unittest.cc
@@ -14,6 +14,7 @@
 #include "components/autofill/core/browser/test_personal_data_manager.h"
 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
 #include "components/autofill/core/common/autofill_clock.h"
+#include "components/strings/grit/components_strings.h"
 #include "services/network/public/cpp/shared_url_loader_factory.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -87,18 +88,6 @@
   std::unique_ptr<AutofillOfferManager> autofill_offer_manager_ = nullptr;
 };
 
-TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_EligibleDiscount) {
-  CreditCard card = CreateCreditCard(kTestGuid);
-  CreateCreditCardOfferForCard(card, "$4");
-
-  std::vector<Suggestion> suggestions = {Suggestion()};
-  suggestions[0].backend_id = kTestGuid;
-  autofill_offer_manager_->UpdateSuggestionsWithOffers(GURL(kTestUrlWithParam),
-                                                       suggestions);
-
-  EXPECT_EQ(suggestions[0].offer_label, base::UTF8ToUTF16("$4 Off"));
-}
-
 TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_EligibleCashback) {
   CreditCard card = CreateCreditCard(kTestGuid);
   CreateCreditCardOfferForCard(card, "5%");
@@ -108,7 +97,8 @@
   autofill_offer_manager_->UpdateSuggestionsWithOffers(GURL(kTestUrlWithParam),
                                                        suggestions);
 
-  EXPECT_EQ(suggestions[0].offer_label, base::UTF8ToUTF16("5% Cash Back"));
+  EXPECT_EQ(suggestions[0].offer_label,
+            l10n_util::GetStringUTF16(IDS_AUTOFILL_OFFERS_CASHBACK));
 }
 
 TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_ExpiredOffer) {
diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp
index f1ad220e8..3ae5f77c 100644
--- a/components/autofill_payments_strings.grdp
+++ b/components/autofill_payments_strings.grdp
@@ -507,10 +507,7 @@
 
   <!-- Credit card offers and rewards related strings -->
   <message name="IDS_AUTOFILL_OFFERS_CASHBACK" desc="Displays that a cashback offer will be rewarded if credit card is used on current page. Part of Autofill suggestions popup.">
-    <ph name="PERCENT">$1<ex>5%</ex></ph> Cash Back
-  </message>
-  <message name="IDS_AUTOFILL_OFFERS_DISCOUNT" desc="Displays a discount that will be rewarded if credit card is used on current page. Part of Autofill suggestions popup.">
-    <ph name="DISCOUNT">$1<ex>$$3</ex></ph> Off
+    Cashback linked
   </message>
 
 </grit-part>
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_OFFERS_CASHBACK.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_OFFERS_CASHBACK.png.sha1
index ef49ef3..e27c712 100644
--- a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_OFFERS_CASHBACK.png.sha1
+++ b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_OFFERS_CASHBACK.png.sha1
@@ -1 +1 @@
-378244426ac8f525d17518614e3d7b1508061cf9
\ No newline at end of file
+130304f80bbc14548f470c8363d9dda1fffc280b
\ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_OFFERS_DISCOUNT.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_OFFERS_DISCOUNT.png.sha1
deleted file mode 100644
index 0f0c9a19..0000000
--- a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_OFFERS_DISCOUNT.png.sha1
+++ /dev/null
@@ -1 +0,0 @@
-a09ae4c895b292cf8ce625cf9843a477d86dfc35
\ No newline at end of file