Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_SAVE_CARD_INFOBAR_DELEGATE_MOB ILE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ASSIST_INFOBAR_DELEGATE_MOBILE _H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_SAVE_CARD_INFOBAR_DELEGATE_MOB ILE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ASSIST_INFOBAR_DELEGATE_MOBILE _H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "components/autofill/core/browser/autofill_metrics.h" | 13 #include "components/autofill/core/browser/autofill_metrics.h" |
| 14 #include "components/autofill/core/browser/legal_message_line.h" | |
| 15 #include "components/infobars/core/confirm_infobar_delegate.h" | 14 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 16 | 15 |
| 17 namespace base { | |
| 18 class DictionaryValue; | |
| 19 } | |
| 20 | |
| 21 namespace autofill { | 16 namespace autofill { |
| 22 | 17 |
| 23 class CreditCard; | 18 class CreditCard; |
| 24 | 19 |
| 25 // An InfoBarDelegate that enables the user to allow or deny storing credit | 20 // An InfoBarDelegate that enables the user to allow or deny filling credit |
| 26 // card information gathered from a form submission. Only used on mobile. | 21 // card information on a website form. Only used on mobile. |
| 27 class AutofillSaveCardInfoBarDelegateMobile : public ConfirmInfoBarDelegate { | 22 class AutofillAssistInfoBarDelegateMobile : public ConfirmInfoBarDelegate { |
| 28 public: | 23 public: |
| 29 AutofillSaveCardInfoBarDelegateMobile( | 24 AutofillAssistInfoBarDelegateMobile(const CreditCard& card, |
|
please use gerrit instead
2016/07/27 17:02:26
The infobar will display only one credit card to f
Mathieu
2016/07/27 21:35:53
Yes, for this patch. Mock calls for a "spinner" ev
| |
| 30 bool upload, | 25 const base::Closure& assist_callback); |
| 31 const CreditCard& card, | |
| 32 std::unique_ptr<base::DictionaryValue> legal_message, | |
| 33 const base::Closure& save_card_callback); | |
| 34 | 26 |
| 35 ~AutofillSaveCardInfoBarDelegateMobile() override; | 27 ~AutofillAssistInfoBarDelegateMobile() override; |
| 36 | 28 |
| 37 int issuer_icon_id() const { return issuer_icon_id_; } | 29 int issuer_icon_id() const { return issuer_icon_id_; } |
| 38 const base::string16& card_label() const { return card_label_; } | 30 const base::string16& card_label() const { return card_label_; } |
| 39 const base::string16& card_sub_label() const { return card_sub_label_; } | 31 const base::string16& card_sub_label() const { return card_sub_label_; } |
| 40 const LegalMessageLines& legal_messages() const { return legal_messages_; } | |
| 41 | |
| 42 // Called when a link in the legal message text was clicked. | |
| 43 void OnLegalMessageLinkClicked(GURL url); | |
| 44 | 32 |
| 45 // ConfirmInfoBarDelegate: | 33 // ConfirmInfoBarDelegate: |
| 46 int GetIconId() const override; | 34 int GetIconId() const override; |
| 47 base::string16 GetMessageText() const override; | 35 base::string16 GetMessageText() const override; |
| 48 base::string16 GetLinkText() const override; | |
| 49 Type GetInfoBarType() const override; | 36 Type GetInfoBarType() const override; |
| 50 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 37 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| 51 bool ShouldExpire(const NavigationDetails& details) const override; | 38 bool ShouldExpire(const NavigationDetails& details) const override; |
| 52 void InfoBarDismissed() override; | 39 void InfoBarDismissed() override; |
| 53 base::string16 GetButtonLabel(InfoBarButton button) const override; | 40 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 54 bool Accept() override; | 41 bool Accept() override; |
| 55 bool Cancel() override; | 42 bool Cancel() override; |
| 56 GURL GetLinkURL() const override; | |
| 57 | 43 |
| 58 private: | 44 private: |
| 59 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); | 45 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); |
| 60 | 46 |
| 61 // Whether the action is an upload or a local save. | |
| 62 bool upload_; | |
| 63 | |
| 64 // The callback to save credit card if the user accepts the infobar. | 47 // The callback to save credit card if the user accepts the infobar. |
| 65 base::Closure save_card_callback_; | 48 base::Closure assist_callback_; |
| 66 | 49 |
| 67 // Did the user ever explicitly accept or dismiss this infobar? | 50 // Did the user ever explicitly accept or dismiss this infobar? |
| 68 bool had_user_interaction_; | 51 bool had_user_interaction_; |
| 69 | 52 |
| 70 // The resource ID for the icon that identifies the issuer of the card. | 53 // The resource ID for the icon that identifies the issuer of the card. |
| 71 int issuer_icon_id_; | 54 int issuer_icon_id_; |
| 72 | 55 |
| 73 // The label for the card to show in the content of the infobar. | 56 // The label for the card to show in the content of the infobar. |
| 74 base::string16 card_label_; | 57 base::string16 card_label_; |
| 75 | 58 |
| 76 // The sub-label for the card to show in the content of the infobar. | 59 // The sub-label for the card to show in the content of the infobar. |
| 77 base::string16 card_sub_label_; | 60 base::string16 card_sub_label_; |
| 78 | 61 |
| 79 // The legal messages to show in the content of the infobar. | 62 DISALLOW_COPY_AND_ASSIGN(AutofillAssistInfoBarDelegateMobile); |
| 80 LegalMessageLines legal_messages_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(AutofillSaveCardInfoBarDelegateMobile); | |
| 83 }; | 63 }; |
| 84 | 64 |
| 85 } // namespace autofill | 65 } // namespace autofill |
| 86 | 66 |
| 87 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_SAVE_CARD_INFOBAR_DELEGATE_ MOBILE_H_ | 67 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ASSIST_INFOBAR_DELEGATE_MOB ILE_H_ |
| OLD | NEW |