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

Side by Side Diff: chrome/browser/autofill/autofill_cc_infobar_delegate.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes Created 7 years, 7 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 unified diff | Download patch
OLDNEW
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/browser/credit_card.h" 9 #include "components/autofill/browser/credit_card.h"
10 #include "components/autofill/browser/personal_data_manager.h" 10 #include "components/autofill/browser/personal_data_manager.h"
11 #include "components/autofill/common/autofill_constants.h" 11 #include "components/autofill/common/autofill_constants.h"
12 #include "content/public/browser/page_navigator.h" 12 #include "content/public/browser/page_navigator.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_delegate.h" 14 #include "content/public/browser/web_contents_delegate.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/resource/resource_bundle.h"
19 18
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(scoped_ptr<InfoBarDelegate>( 27 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
(...skipping 30 matching lines...) Expand all
59 DCHECK(!had_user_interaction_); 58 DCHECK(!had_user_interaction_);
60 59
61 metric_logger_->LogCreditCardInfoBarMetric(user_action); 60 metric_logger_->LogCreditCardInfoBarMetric(user_action);
62 had_user_interaction_ = true; 61 had_user_interaction_ = true;
63 } 62 }
64 63
65 void AutofillCCInfoBarDelegate::InfoBarDismissed() { 64 void AutofillCCInfoBarDelegate::InfoBarDismissed() {
66 LogUserAction(AutofillMetrics::INFOBAR_DENIED); 65 LogUserAction(AutofillMetrics::INFOBAR_DENIED);
67 } 66 }
68 67
69 gfx::Image* AutofillCCInfoBarDelegate::GetIcon() const { 68 int AutofillCCInfoBarDelegate::GetIconID() const {
70 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 69 return IDR_INFOBAR_AUTOFILL;
71 IDR_INFOBAR_AUTOFILL);
72 } 70 }
73 71
74 InfoBarDelegate::Type AutofillCCInfoBarDelegate::GetInfoBarType() const { 72 InfoBarDelegate::Type AutofillCCInfoBarDelegate::GetInfoBarType() const {
75 return PAGE_ACTION_TYPE; 73 return PAGE_ACTION_TYPE;
76 } 74 }
77 75
78 bool AutofillCCInfoBarDelegate::ShouldExpireInternal( 76 bool AutofillCCInfoBarDelegate::ShouldExpireInternal(
79 const content::LoadCommittedDetails& details) const { 77 const content::LoadCommittedDetails& details) const {
80 // The user has submitted a form, causing the page to navigate elsewhere. We 78 // The user has submitted a form, causing the page to navigate elsewhere. We
81 // don't want the infobar to be expired at this point, because the user won't 79 // don't want the infobar to be expired at this point, because the user won't
(...skipping 28 matching lines...) Expand all
110 108
111 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { 109 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
112 web_contents()->OpenURL(content::OpenURLParams( 110 web_contents()->OpenURL(content::OpenURLParams(
113 GURL(autofill::kHelpURL), content::Referrer(), 111 GURL(autofill::kHelpURL), content::Referrer(),
114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 112 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
115 content::PAGE_TRANSITION_LINK, false)); 113 content::PAGE_TRANSITION_LINK, false));
116 return false; 114 return false;
117 } 115 }
118 116
119 } // namespace autofill 117 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698