Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Unified Diff: chrome/browser/autofill/autofill_cc_infobar_delegate.cc

Issue 710453002: [Autofill] Componentize AutofillCCInfoBarDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed breakages on Android port. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/autofill_cc_infobar_delegate.cc
diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc
deleted file mode 100644
index 430a79c4ac5b934e9ed38d9c7836eff3a78bcddb..0000000000000000000000000000000000000000
--- a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
-
-#include "base/logging.h"
-#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/grit/generated_resources.h"
-#include "chrome/grit/google_chrome_strings.h"
-#include "components/autofill/core/browser/credit_card.h"
-#include "components/autofill/core/browser/personal_data_manager.h"
-#include "components/autofill/core/common/autofill_constants.h"
-#include "components/infobars/core/infobar.h"
-#include "content/public/browser/page_navigator.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_delegate.h"
-#include "grit/components_strings.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-
-namespace autofill {
-
-// static
-void AutofillCCInfoBarDelegate::Create(
- InfoBarService* infobar_service,
- const base::Closure& save_card_callback) {
- infobar_service->AddInfoBar(
- infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
- new AutofillCCInfoBarDelegate(save_card_callback))));
-}
-
-AutofillCCInfoBarDelegate::AutofillCCInfoBarDelegate(
- const base::Closure& save_card_callback)
- : ConfirmInfoBarDelegate(),
- save_card_callback_(save_card_callback),
- had_user_interaction_(false) {
- AutofillMetrics::LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN);
-}
-
-AutofillCCInfoBarDelegate::~AutofillCCInfoBarDelegate() {
- if (!had_user_interaction_)
- LogUserAction(AutofillMetrics::INFOBAR_IGNORED);
-}
-
-void AutofillCCInfoBarDelegate::LogUserAction(
- AutofillMetrics::InfoBarMetric user_action) {
- DCHECK(!had_user_interaction_);
-
- AutofillMetrics::LogCreditCardInfoBarMetric(user_action);
- had_user_interaction_ = true;
-}
-
-void AutofillCCInfoBarDelegate::InfoBarDismissed() {
- LogUserAction(AutofillMetrics::INFOBAR_DENIED);
-}
-
-int AutofillCCInfoBarDelegate::GetIconID() const {
- return IDR_INFOBAR_AUTOFILL_CC;
-}
-
-infobars::InfoBarDelegate::Type AutofillCCInfoBarDelegate::GetInfoBarType()
- const {
- return PAGE_ACTION_TYPE;
-}
-
-bool AutofillCCInfoBarDelegate::ShouldExpireInternal(
- const NavigationDetails& details) const {
- // The user has submitted a form, causing the page to navigate elsewhere. We
- // don't want the infobar to be expired at this point, because the user won't
- // get a chance to answer the question.
- return false;
-}
-
-base::string16 AutofillCCInfoBarDelegate::GetMessageText() const {
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT);
-}
-
-base::string16 AutofillCCInfoBarDelegate::GetButtonLabel(
- InfoBarButton button) const {
- return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
- IDS_AUTOFILL_CC_INFOBAR_ACCEPT : IDS_AUTOFILL_CC_INFOBAR_DENY);
-}
-
-bool AutofillCCInfoBarDelegate::Accept() {
- save_card_callback_.Run();
- save_card_callback_.Reset();
- LogUserAction(AutofillMetrics::INFOBAR_ACCEPTED);
- return true;
-}
-
-bool AutofillCCInfoBarDelegate::Cancel() {
- LogUserAction(AutofillMetrics::INFOBAR_DENIED);
- return true;
-}
-
-base::string16 AutofillCCInfoBarDelegate::GetLinkText() const {
- return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
-}
-
-bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
- InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
- content::OpenURLParams(
- GURL(autofill::kHelpURL), content::Referrer(),
- (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
- ui::PAGE_TRANSITION_LINK, false));
- return false;
-}
-
-} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698