| 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" |
| 8 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "components/autofill/core/browser/credit_card.h" | 10 #include "components/autofill/core/browser/credit_card.h" |
| 10 #include "components/autofill/core/browser/personal_data_manager.h" | 11 #include "components/autofill/core/browser/personal_data_manager.h" |
| 11 #include "components/autofill/core/common/autofill_constants.h" | 12 #include "components/autofill/core/common/autofill_constants.h" |
| 12 #include "content/public/browser/page_navigator.h" | 13 #include "content/public/browser/page_navigator.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | 15 #include "content/public/browser/web_contents_delegate.h" |
| 15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 16 #include "grit/google_chrome_strings.h" | 17 #include "grit/google_chrome_strings.h" |
| 17 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 | 20 |
| 20 namespace autofill { | 21 namespace autofill { |
| 21 | 22 |
| 22 // static | 23 // static |
| 23 void AutofillCCInfoBarDelegate::Create( | 24 void AutofillCCInfoBarDelegate::Create( |
| 24 InfoBarService* infobar_service, | 25 InfoBarService* infobar_service, |
| 25 const AutofillMetrics* metric_logger, | 26 const AutofillMetrics* metric_logger, |
| 26 const base::Closure& save_card_callback) { | 27 const base::Closure& save_card_callback) { |
| 27 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( | 28 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 28 new AutofillCCInfoBarDelegate( | 29 scoped_ptr<ConfirmInfoBarDelegate>(new AutofillCCInfoBarDelegate( |
| 29 infobar_service, metric_logger, save_card_callback))); | 30 metric_logger, save_card_callback)))); |
| 30 } | 31 } |
| 31 | 32 |
| 32 AutofillCCInfoBarDelegate::AutofillCCInfoBarDelegate( | 33 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(infobar_service), | 36 : ConfirmInfoBarDelegate(), |
| 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 |