OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 5 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "components/autofill/core/browser/credit_card.h" | 9 #include "components/autofill/core/browser/credit_card.h" |
10 #include "components/autofill/core/browser/personal_data_manager.h" | 10 #include "components/autofill/core/browser/personal_data_manager.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 bool AutofillCCInfoBarDelegate::ShouldExpireInternal( | 68 bool AutofillCCInfoBarDelegate::ShouldExpireInternal( |
69 const content::LoadCommittedDetails& details) const { | 69 const content::LoadCommittedDetails& details) const { |
70 // The user has submitted a form, causing the page to navigate elsewhere. We | 70 // The user has submitted a form, causing the page to navigate elsewhere. We |
71 // don't want the infobar to be expired at this point, because the user won't | 71 // don't want the infobar to be expired at this point, because the user won't |
72 // get a chance to answer the question. | 72 // get a chance to answer the question. |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 string16 AutofillCCInfoBarDelegate::GetMessageText() const { | 76 base::string16 AutofillCCInfoBarDelegate::GetMessageText() const { |
77 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT); | 77 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT); |
78 } | 78 } |
79 | 79 |
80 string16 AutofillCCInfoBarDelegate::GetButtonLabel(InfoBarButton button) const { | 80 base::string16 AutofillCCInfoBarDelegate::GetButtonLabel( |
| 81 InfoBarButton button) const { |
81 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 82 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
82 IDS_AUTOFILL_CC_INFOBAR_ACCEPT : IDS_AUTOFILL_CC_INFOBAR_DENY); | 83 IDS_AUTOFILL_CC_INFOBAR_ACCEPT : IDS_AUTOFILL_CC_INFOBAR_DENY); |
83 } | 84 } |
84 | 85 |
85 bool AutofillCCInfoBarDelegate::Accept() { | 86 bool AutofillCCInfoBarDelegate::Accept() { |
86 save_card_callback_.Run(); | 87 save_card_callback_.Run(); |
87 save_card_callback_.Reset(); | 88 save_card_callback_.Reset(); |
88 LogUserAction(AutofillMetrics::INFOBAR_ACCEPTED); | 89 LogUserAction(AutofillMetrics::INFOBAR_ACCEPTED); |
89 return true; | 90 return true; |
90 } | 91 } |
91 | 92 |
92 bool AutofillCCInfoBarDelegate::Cancel() { | 93 bool AutofillCCInfoBarDelegate::Cancel() { |
93 LogUserAction(AutofillMetrics::INFOBAR_DENIED); | 94 LogUserAction(AutofillMetrics::INFOBAR_DENIED); |
94 return true; | 95 return true; |
95 } | 96 } |
96 | 97 |
97 string16 AutofillCCInfoBarDelegate::GetLinkText() const { | 98 base::string16 AutofillCCInfoBarDelegate::GetLinkText() const { |
98 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 99 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
99 } | 100 } |
100 | 101 |
101 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 102 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
102 web_contents()->OpenURL(content::OpenURLParams( | 103 web_contents()->OpenURL(content::OpenURLParams( |
103 GURL(autofill::kHelpURL), content::Referrer(), | 104 GURL(autofill::kHelpURL), content::Referrer(), |
104 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 105 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
105 content::PAGE_TRANSITION_LINK, false)); | 106 content::PAGE_TRANSITION_LINK, false)); |
106 return false; | 107 return false; |
107 } | 108 } |
108 | 109 |
109 } // namespace autofill | 110 } // namespace autofill |
OLD | NEW |