Chromium Code Reviews| Index: components/autofill/core/browser/autofill_cc_infobar_delegate.cc |
| diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc b/components/autofill/core/browser/autofill_cc_infobar_delegate.cc |
| similarity index 76% |
| rename from chrome/browser/autofill/autofill_cc_infobar_delegate.cc |
| rename to components/autofill/core/browser/autofill_cc_infobar_delegate.cc |
| index f2fd9ea8d0e636e17b3b0e6409ad247c578504f4..026a7282676bd0898ef095fe33d2f90ff3de32fc 100644 |
| --- a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc |
| +++ b/components/autofill/core/browser/autofill_cc_infobar_delegate.cc |
| @@ -2,39 +2,40 @@ |
| // 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 "components/autofill/core/browser/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/autofill_client.h" |
| +#include "components/autofill/core/browser/autofill_driver.h" |
| +#include "components/autofill/core/browser/autofill_manager.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 "components/infobars/core/infobar_manager.h" |
| +#include "grit/components_scaled_resources.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, |
| + infobars::InfoBarManager* infobar_manager, |
| + AutofillManager* autofill_manager, |
|
Ilya Sherman
2014/12/03 20:00:21
Can you pass the driver directly, rather than pass
Pritam Nikam
2014/12/04 15:37:30
In that case, I have to pass both AutofillClient a
|
| const AutofillMetrics* metric_logger, |
| const base::Closure& save_card_callback) { |
| - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| + infobar_manager->AddInfoBar(autofill_manager->client()->CreateInfoBar( |
| scoped_ptr<ConfirmInfoBarDelegate>(new AutofillCCInfoBarDelegate( |
| - metric_logger, save_card_callback)))); |
| + autofill_manager->driver(), metric_logger, save_card_callback)))); |
| } |
| AutofillCCInfoBarDelegate::AutofillCCInfoBarDelegate( |
| + AutofillDriver* autofill_driver, |
| const AutofillMetrics* metric_logger, |
| const base::Closure& save_card_callback) |
| : ConfirmInfoBarDelegate(), |
| + autofill_driver_(autofill_driver), |
| metric_logger_(metric_logger), |
| save_card_callback_(save_card_callback), |
| had_user_interaction_(false) { |
| @@ -82,7 +83,7 @@ base::string16 AutofillCCInfoBarDelegate::GetMessageText() const { |
| base::string16 AutofillCCInfoBarDelegate::GetButtonLabel( |
| InfoBarButton button) const { |
| return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| - IDS_AUTOFILL_CC_INFOBAR_ACCEPT : IDS_AUTOFILL_CC_INFOBAR_DENY); |
| + IDS_AUTOFILL_CC_INFOBAR_ACCEPT : IDS_AUTOFILL_CC_INFOBAR_DENY); |
|
Ilya Sherman
2014/12/03 20:00:20
Hmm, this formatting change looks wrong -- is this
Pritam Nikam
2014/12/04 15:37:30
Done.
on "git cl format"
return l10n_util::Get
|
| } |
| bool AutofillCCInfoBarDelegate::Accept() { |
| @@ -102,11 +103,7 @@ base::string16 AutofillCCInfoBarDelegate::GetLinkText() const { |
| } |
| 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)); |
| + autofill_driver_->LinkClicked(GURL(autofill::kHelpURL), disposition); |
|
Ilya Sherman
2014/12/03 20:00:20
You've dropped the code that sets the disposition.
Pritam Nikam
2014/12/04 15:37:30
Done.
|
| return false; |
| } |