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

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

Issue 11748012: Minor cleanup to how infobars handle expiry: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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/api/infobars/infobar_service.h" 8 #include "chrome/browser/api/infobars/infobar_service.h"
9 #include "chrome/browser/autofill/credit_card.h" 9 #include "chrome/browser/autofill/credit_card.h"
10 #include "chrome/browser/autofill/personal_data_manager.h" 10 #include "chrome/browser/autofill/personal_data_manager.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 void AutofillCCInfoBarDelegate::LogUserAction( 38 void AutofillCCInfoBarDelegate::LogUserAction(
39 AutofillMetrics::InfoBarMetric user_action) { 39 AutofillMetrics::InfoBarMetric user_action) {
40 DCHECK(!had_user_interaction_); 40 DCHECK(!had_user_interaction_);
41 41
42 metric_logger_->LogCreditCardInfoBarMetric(user_action); 42 metric_logger_->LogCreditCardInfoBarMetric(user_action);
43 had_user_interaction_ = true; 43 had_user_interaction_ = true;
44 } 44 }
45 45
46 bool AutofillCCInfoBarDelegate::ShouldExpire(
47 const content::LoadCommittedDetails& details) const {
48 // The user has submitted a form, causing the page to navigate elsewhere. We
49 // don't want the infobar to be expired at this point, because the user won't
50 // get a chance to answer the question.
51 return false;
52 }
53
54 void AutofillCCInfoBarDelegate::InfoBarDismissed() { 46 void AutofillCCInfoBarDelegate::InfoBarDismissed() {
55 LogUserAction(AutofillMetrics::INFOBAR_DENIED); 47 LogUserAction(AutofillMetrics::INFOBAR_DENIED);
56 } 48 }
57 49
58 gfx::Image* AutofillCCInfoBarDelegate::GetIcon() const { 50 gfx::Image* AutofillCCInfoBarDelegate::GetIcon() const {
59 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 51 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
60 IDR_INFOBAR_AUTOFILL); 52 IDR_INFOBAR_AUTOFILL);
61 } 53 }
62 54
63 InfoBarDelegate::Type AutofillCCInfoBarDelegate::GetInfoBarType() const { 55 InfoBarDelegate::Type AutofillCCInfoBarDelegate::GetInfoBarType() const {
64 return PAGE_ACTION_TYPE; 56 return PAGE_ACTION_TYPE;
65 } 57 }
66 58
59 bool AutofillCCInfoBarDelegate::ShouldExpireInternal(
60 const content::LoadCommittedDetails& details) const {
61 // The user has submitted a form, causing the page to navigate elsewhere. We
62 // don't want the infobar to be expired at this point, because the user won't
63 // get a chance to answer the question.
64 return false;
65 }
66
67 string16 AutofillCCInfoBarDelegate::GetMessageText() const { 67 string16 AutofillCCInfoBarDelegate::GetMessageText() const {
68 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT); 68 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT);
69 } 69 }
70 70
71 string16 AutofillCCInfoBarDelegate::GetButtonLabel(InfoBarButton button) const { 71 string16 AutofillCCInfoBarDelegate::GetButtonLabel(InfoBarButton button) const {
72 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 72 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
73 IDS_AUTOFILL_CC_INFOBAR_ACCEPT : IDS_AUTOFILL_CC_INFOBAR_DENY); 73 IDS_AUTOFILL_CC_INFOBAR_ACCEPT : IDS_AUTOFILL_CC_INFOBAR_DENY);
74 } 74 }
75 75
76 bool AutofillCCInfoBarDelegate::Accept() { 76 bool AutofillCCInfoBarDelegate::Accept() {
(...skipping 14 matching lines...) Expand all
91 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { 91 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
92 owner()->GetWebContents()->GetDelegate()->OpenURLFromTab( 92 owner()->GetWebContents()->GetDelegate()->OpenURLFromTab(
93 owner()->GetWebContents(), 93 owner()->GetWebContents(),
94 content::OpenURLParams(GURL(chrome::kAutofillHelpURL), 94 content::OpenURLParams(GURL(chrome::kAutofillHelpURL),
95 content::Referrer(), 95 content::Referrer(),
96 NEW_FOREGROUND_TAB, 96 NEW_FOREGROUND_TAB,
97 content::PAGE_TRANSITION_LINK, 97 content::PAGE_TRANSITION_LINK,
98 false)); 98 false));
99 return false; 99 return false;
100 } 100 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_cc_infobar_delegate.h ('k') | chrome/browser/chrome_quota_permission_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698