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

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

Issue 6926001: Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autofill/credit_card.h" 8 #include "chrome/browser/autofill/credit_card.h"
9 #include "chrome/browser/autofill/personal_data_manager.h" 9 #include "chrome/browser/autofill/personal_data_manager.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 10 matching lines...) Expand all
21 const AutofillMetrics* metric_logger) 21 const AutofillMetrics* metric_logger)
22 : ConfirmInfoBarDelegate(tab_contents), 22 : ConfirmInfoBarDelegate(tab_contents),
23 credit_card_(credit_card), 23 credit_card_(credit_card),
24 personal_data_(personal_data), 24 personal_data_(personal_data),
25 metric_logger_(metric_logger), 25 metric_logger_(metric_logger),
26 had_user_interaction_(false) { 26 had_user_interaction_(false) {
27 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN); 27 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN);
28 } 28 }
29 29
30 AutofillCCInfoBarDelegate::~AutofillCCInfoBarDelegate() { 30 AutofillCCInfoBarDelegate::~AutofillCCInfoBarDelegate() {
31 if (!had_user_interaction_)
32 LogUserAction(AutofillMetrics::INFOBAR_IGNORED);
31 } 33 }
32 34
33 void AutofillCCInfoBarDelegate::LogUserAction( 35 void AutofillCCInfoBarDelegate::LogUserAction(
34 AutofillMetrics::InfoBarMetric user_action) { 36 AutofillMetrics::InfoBarMetric user_action) {
35 DCHECK(!had_user_interaction_); 37 DCHECK(!had_user_interaction_);
36 38
37 metric_logger_->LogCreditCardInfoBarMetric(user_action); 39 metric_logger_->LogCreditCardInfoBarMetric(user_action);
38 had_user_interaction_ = true; 40 had_user_interaction_ = true;
39 } 41 }
40 42
41 bool AutofillCCInfoBarDelegate::ShouldExpire( 43 bool AutofillCCInfoBarDelegate::ShouldExpire(
42 const NavigationController::LoadCommittedDetails& details) const { 44 const NavigationController::LoadCommittedDetails& details) const {
43 // The user has submitted a form, causing the page to navigate elsewhere. We 45 // The user has submitted a form, causing the page to navigate elsewhere. We
44 // don't want the infobar to be expired at this point, because the user won't 46 // don't want the infobar to be expired at this point, because the user won't
45 // get a chance to answer the question. 47 // get a chance to answer the question.
46 return false; 48 return false;
47 } 49 }
48 50
49 void AutofillCCInfoBarDelegate::InfoBarClosed() {
50 if (!had_user_interaction_)
51 LogUserAction(AutofillMetrics::INFOBAR_IGNORED);
52
53 delete this;
54 }
55
56 void AutofillCCInfoBarDelegate::InfoBarDismissed() { 51 void AutofillCCInfoBarDelegate::InfoBarDismissed() {
57 LogUserAction(AutofillMetrics::INFOBAR_DENIED); 52 LogUserAction(AutofillMetrics::INFOBAR_DENIED);
58 } 53 }
59 54
60 gfx::Image* AutofillCCInfoBarDelegate::GetIcon() const { 55 gfx::Image* AutofillCCInfoBarDelegate::GetIcon() const {
61 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 56 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
62 IDR_INFOBAR_AUTOFILL); 57 IDR_INFOBAR_AUTOFILL);
63 } 58 }
64 59
65 InfoBarDelegate::Type AutofillCCInfoBarDelegate::GetInfoBarType() const { 60 InfoBarDelegate::Type AutofillCCInfoBarDelegate::GetInfoBarType() const {
(...skipping 23 matching lines...) Expand all
89 string16 AutofillCCInfoBarDelegate::GetLinkText() { 84 string16 AutofillCCInfoBarDelegate::GetLinkText() {
90 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 85 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
91 } 86 }
92 87
93 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { 88 bool AutofillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
94 Browser* browser = BrowserList::GetLastActive(); 89 Browser* browser = BrowserList::GetLastActive();
95 DCHECK(browser); 90 DCHECK(browser);
96 browser->OpenAutofillHelpTabAndActivate(); 91 browser->OpenAutofillHelpTabAndActivate();
97 return false; 92 return false;
98 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698