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..00e5f59e1418d7e0bfbb34b987d0efc6a326a405 100644 |
--- a/components/autofill/core/browser/autofill_cc_infobar_delegate.h |
+++ b/components/autofill/core/browser/autofill_cc_infobar_delegate.h |
@@ -14,12 +14,19 @@ |
#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; |
+class LegalMessageLine; |
+ |
// 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,39 @@ 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 std::vector<scoped_ptr<LegalMessageLine>>& 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 +84,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. |
+ std::vector<scoped_ptr<LegalMessageLine>> legal_messages_; |
+ |
// The callback to save credit card if the user accepts the infobar. |
base::Closure save_card_callback_; |