Chromium Code Reviews| Index: components/autofill/core/browser/autofill_credit_card_filling_infobar_delegate_mobile.h |
| diff --git a/components/autofill/core/browser/autofill_credit_card_filling_infobar_delegate_mobile.h b/components/autofill/core/browser/autofill_credit_card_filling_infobar_delegate_mobile.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a43e0ec037f680b84d1f14d2b5ef684957020af0 |
| --- /dev/null |
| +++ b/components/autofill/core/browser/autofill_credit_card_filling_infobar_delegate_mobile.h |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CREDIT_CARD_FILLING_INFOBAR_DELEGATE_MOBILE_H_ |
| +#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CREDIT_CARD_FILLING_INFOBAR_DELEGATE_MOBILE_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "base/strings/string16.h" |
| +#include "components/autofill/core/browser/autofill_metrics.h" |
| +#include "components/infobars/core/confirm_infobar_delegate.h" |
| + |
| +namespace infobars { |
| +class InfoBarManager; |
| +} |
| + |
| +namespace autofill { |
| + |
| +class CreditCard; |
| + |
| +// An InfoBarDelegate that enables the user to allow or deny filling credit |
| +// card information on a website form. Only used on mobile. |
| +class AutofillCreditCardFillingInfoBarDelegateMobile |
| + : public ConfirmInfoBarDelegate { |
| + public: |
| + AutofillCreditCardFillingInfoBarDelegateMobile( |
| + const CreditCard& card, |
| + const base::Closure& card_filling_callback); |
| + ~AutofillCreditCardFillingInfoBarDelegateMobile() 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_; } |
| + void set_was_shown(bool was_shown) { was_shown_ = was_shown; } |
|
Peter Kasting
2016/08/03 02:25:40
Nit: It makes no sense to support set_was_shown(fa
Mathieu
2016/08/03 18:34:44
Done.
|
| + |
| + // ConfirmInfoBarDelegate (publicly exposed): |
| + int GetIconId() const override; |
| + base::string16 GetMessageText() const override; |
| + |
| + protected: |
|
Peter Kasting
2016/08/03 02:25:40
Nit: It looks like you only access about half of t
Mathieu
2016/08/03 18:34:44
Done.
|
| + // ConfirmInfoBarDelegate (continued): |
| + Type GetInfoBarType() const override; |
| + infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| + void InfoBarDismissed() override; |
| + base::string16 GetButtonLabel(InfoBarButton button) const override; |
| + bool Accept() override; |
| + bool Cancel() override; |
| + |
| + private: |
| + void LogUserAction(AutofillMetrics::InfoBarMetric user_action); |
| + |
| + // The callback after having accepted the infobar; will initiate filling the |
| + // credit card information. |
| + base::Closure card_filling_callback_; |
| + |
| + // Did the user ever explicitly accept or dismiss this infobar? |
| + bool had_user_interaction_; |
| + |
| + // Tracks whether the infobar was shown. |
| + bool was_shown_; |
| + |
| + // The resource ID for the icon that identifies the issuer of the card. |
| + int issuer_icon_id_; |
| + |
| + base::string16 card_label_; |
| + base::string16 card_sub_label_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardFillingInfoBarDelegateMobile); |
| +}; |
| + |
| +} // namespace autofill |
| + |
| +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CREDIT_CARD_FILLING_INFOBAR_DELEGATE_MOBILE_H_ |