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.h" | |
9 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "components/autofill/core/browser/credit_card.h" | 9 #include "components/autofill/core/browser/credit_card.h" |
11 #include "components/autofill/core/browser/personal_data_manager.h" | 10 #include "components/autofill/core/browser/personal_data_manager.h" |
12 #include "components/autofill/core/common/autofill_constants.h" | 11 #include "components/autofill/core/common/autofill_constants.h" |
13 #include "content/public/browser/page_navigator.h" | 12 #include "content/public/browser/page_navigator.h" |
14 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
15 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
16 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
17 #include "grit/google_chrome_strings.h" | 16 #include "grit/google_chrome_strings.h" |
18 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
20 | 19 |
21 namespace autofill { | 20 namespace autofill { |
22 | 21 |
23 // static | 22 // static |
24 void AutofillCCInfoBarDelegate::Create( | 23 void AutofillCCInfoBarDelegate::Create( |
25 InfoBarService* infobar_service, | 24 InfoBarService* infobar_service, |
26 const AutofillMetrics* metric_logger, | 25 const AutofillMetrics* metric_logger, |
27 const base::Closure& save_card_callback) { | 26 const base::Closure& save_card_callback) { |
28 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 27 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( |
29 scoped_ptr<ConfirmInfoBarDelegate>(new AutofillCCInfoBarDelegate( | 28 new AutofillCCInfoBarDelegate( |
30 metric_logger, save_card_callback)))); | 29 infobar_service, metric_logger, save_card_callback))); |
31 } | 30 } |
32 | 31 |
33 AutofillCCInfoBarDelegate::AutofillCCInfoBarDelegate( | 32 AutofillCCInfoBarDelegate::AutofillCCInfoBarDelegate( |
| 33 InfoBarService* infobar_service, |
34 const AutofillMetrics* metric_logger, | 34 const AutofillMetrics* metric_logger, |
35 const base::Closure& save_card_callback) | 35 const base::Closure& save_card_callback) |
36 : ConfirmInfoBarDelegate(), | 36 : ConfirmInfoBarDelegate(infobar_service), |
37 metric_logger_(metric_logger), | 37 metric_logger_(metric_logger), |
38 save_card_callback_(save_card_callback), | 38 save_card_callback_(save_card_callback), |
39 had_user_interaction_(false) { | 39 had_user_interaction_(false) { |
40 metric_logger->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN); | 40 metric_logger->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN); |
41 } | 41 } |
42 | 42 |
43 AutofillCCInfoBarDelegate::~AutofillCCInfoBarDelegate() { | 43 AutofillCCInfoBarDelegate::~AutofillCCInfoBarDelegate() { |
44 if (!had_user_interaction_) | 44 if (!had_user_interaction_) |
45 LogUserAction(AutofillMetrics::INFOBAR_IGNORED); | 45 LogUserAction(AutofillMetrics::INFOBAR_IGNORED); |
46 } | 46 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 101 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
102 web_contents()->OpenURL(content::OpenURLParams( | 102 web_contents()->OpenURL(content::OpenURLParams( |
103 GURL(autofill::kHelpURL), content::Referrer(), | 103 GURL(autofill::kHelpURL), content::Referrer(), |
104 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 104 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
105 content::PAGE_TRANSITION_LINK, false)); | 105 content::PAGE_TRANSITION_LINK, false)); |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 } // namespace autofill | 109 } // namespace autofill |
OLD | NEW |