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

Unified Diff: components/autofill/core/browser/autofill_cc_infobar_delegate.h

Issue 1540423004: Add card details and legal message to Android save credit card infobar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Justin's nits. Created 4 years, 11 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_cc_infobar_delegate.h
diff --git a/components/autofill/core/browser/autofill_cc_infobar_delegate.h b/components/autofill/core/browser/autofill_cc_infobar_delegate.h
index 8e50a052ffe3170744bc93b2323f58013b58a1a7..2b33c0916166a815f839a9dafe3f1dbabd871ac8 100644
--- a/components/autofill/core/browser/autofill_cc_infobar_delegate.h
+++ b/components/autofill/core/browser/autofill_cc_infobar_delegate.h
@@ -11,15 +11,22 @@
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "components/autofill/core/browser/autofill_metrics.h"
+#include "components/autofill/core/browser/legal_message_line.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "ui/base/window_open_disposition.h"
+namespace base {
+class DictionaryValue;
+}
+
namespace infobars {
class InfoBarManager;
}
namespace autofill {
+class CreditCard;
+
// An InfoBar delegate that enables the user to allow or deny storing credit
// card information gathered from a form submission.
class AutofillCCInfoBarDelegate : public ConfirmInfoBarDelegate {
@@ -27,22 +34,37 @@ class AutofillCCInfoBarDelegate : public ConfirmInfoBarDelegate {
// Creates an autofill credit card infobar and delegate and adds the infobar
// to |infobar_manager|.
static void CreateForLocalSave(infobars::InfoBarManager* infobar_manager,
+ const CreditCard& card,
const base::Closure& save_card_callback);
static void CreateForUpload(infobars::InfoBarManager* infobar_manager,
+ const CreditCard& card,
+ scoped_ptr<base::DictionaryValue> legal_message,
const base::Closure& save_card_callback);
#if defined(UNIT_TEST)
static scoped_ptr<ConfirmInfoBarDelegate> Create(
const base::Closure& save_card_callback) {
- return scoped_ptr<ConfirmInfoBarDelegate>(
- new AutofillCCInfoBarDelegate(false, save_card_callback));
+ return scoped_ptr<ConfirmInfoBarDelegate>(new AutofillCCInfoBarDelegate(
+ false, CreditCard(), scoped_ptr<base::DictionaryValue>(nullptr),
+ save_card_callback));
}
#endif
+ ~AutofillCCInfoBarDelegate() override;
+
+ int issuer_icon_id() const { return issuer_icon_id_; }
+ const base::string16& card_label() const { return card_label_; }
+ const base::string16& card_sub_label() const { return card_sub_label_; }
+ const LegalMessageLines& legal_messages() const { return legal_messages_; }
+
+ // Called when a link in the legal message text was clicked.
+ void OnLegalMessageLinkClicked(GURL url);
+
private:
AutofillCCInfoBarDelegate(bool upload,
+ const CreditCard& card,
+ scoped_ptr<base::DictionaryValue> legal_message,
const base::Closure& save_card_callback);
- ~AutofillCCInfoBarDelegate() override;
void LogUserAction(AutofillMetrics::InfoBarMetric user_action);
@@ -60,8 +82,21 @@ class AutofillCCInfoBarDelegate : public ConfirmInfoBarDelegate {
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
+ // Whether the infobar is for uploading the credit card.
bool upload_;
+ // The resource ID for the icon that identifies the issuer of the card.
+ int issuer_icon_id_;
+
+ // The label for the card to show in the content of the infobar.
+ base::string16 card_label_;
+
+ // The sub-label for the card to show in the content onf the infobar.
+ base::string16 card_sub_label_;
+
+ // The legal messages to show in the content of the infobar.
+ LegalMessageLines legal_messages_;
+
// The callback to save credit card if the user accepts the infobar.
base::Closure save_card_callback_;

Powered by Google App Engine
This is Rietveld 408576698