| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CC_INFOBAR_DELEGATE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 const base::Closure& save_card_callback); | 32 const base::Closure& save_card_callback); |
| 33 | 33 |
| 34 #if defined(UNIT_TEST) | 34 #if defined(UNIT_TEST) |
| 35 static scoped_ptr<ConfirmInfoBarDelegate> Create( | 35 static scoped_ptr<ConfirmInfoBarDelegate> Create( |
| 36 const base::Closure& save_card_callback) { | 36 const base::Closure& save_card_callback) { |
| 37 return scoped_ptr<ConfirmInfoBarDelegate>( | 37 return scoped_ptr<ConfirmInfoBarDelegate>( |
| 38 new AutofillCCInfoBarDelegate(false, save_card_callback)); | 38 new AutofillCCInfoBarDelegate(false, save_card_callback)); |
| 39 } | 39 } |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 private: | 42 ~AutofillCCInfoBarDelegate() override; |
| 43 |
| 44 // ConfirmInfoBarDelegate: |
| 45 int GetIconId() const override; |
| 46 base::string16 GetMessageText() const override; |
| 47 base::string16 GetLinkText() const override; |
| 48 |
| 49 protected: |
| 43 AutofillCCInfoBarDelegate(bool upload, | 50 AutofillCCInfoBarDelegate(bool upload, |
| 44 const base::Closure& save_card_callback); | 51 const base::Closure& save_card_callback); |
| 45 ~AutofillCCInfoBarDelegate() override; | |
| 46 | 52 |
| 53 private: |
| 47 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); | 54 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); |
| 48 | 55 |
| 49 // ConfirmInfoBarDelegate: | 56 // ConfirmInfoBarDelegate: |
| 50 Type GetInfoBarType() const override; | 57 Type GetInfoBarType() const override; |
| 51 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 58 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| 52 int GetIconId() const override; | |
| 53 gfx::VectorIconId GetVectorIconId() const override; | 59 gfx::VectorIconId GetVectorIconId() const override; |
| 54 bool ShouldExpire(const NavigationDetails& details) const override; | 60 bool ShouldExpire(const NavigationDetails& details) const override; |
| 55 void InfoBarDismissed() override; | 61 void InfoBarDismissed() override; |
| 56 base::string16 GetMessageText() const override; | |
| 57 base::string16 GetButtonLabel(InfoBarButton button) const override; | 62 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 58 bool Accept() override; | 63 bool Accept() override; |
| 59 bool Cancel() override; | 64 bool Cancel() override; |
| 60 base::string16 GetLinkText() const override; | |
| 61 GURL GetLinkURL() const override; | 65 GURL GetLinkURL() const override; |
| 62 | 66 |
| 63 bool upload_; | 67 bool upload_; |
| 64 | 68 |
| 65 // The callback to save credit card if the user accepts the infobar. | 69 // The callback to save credit card if the user accepts the infobar. |
| 66 base::Closure save_card_callback_; | 70 base::Closure save_card_callback_; |
| 67 | 71 |
| 68 // Did the user ever explicitly accept or dismiss this infobar? | 72 // Did the user ever explicitly accept or dismiss this infobar? |
| 69 bool had_user_interaction_; | 73 bool had_user_interaction_; |
| 70 | 74 |
| 71 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, CreditCardInfoBar); | 75 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, CreditCardInfoBar); |
| 72 | 76 |
| 73 DISALLOW_COPY_AND_ASSIGN(AutofillCCInfoBarDelegate); | 77 DISALLOW_COPY_AND_ASSIGN(AutofillCCInfoBarDelegate); |
| 74 }; | 78 }; |
| 75 | 79 |
| 76 } // namespace autofill | 80 } // namespace autofill |
| 77 | 81 |
| 78 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_ | 82 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_ |
| OLD | NEW |