Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/histogram.h" | |
| 9 #include "chrome/browser/autofill/autofill_cc_infobar.h" | 10 #include "chrome/browser/autofill/autofill_cc_infobar.h" |
| 10 #include "chrome/browser/autofill/autofill_manager.h" | 11 #include "chrome/browser/autofill/autofill_manager.h" |
| 11 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
| 12 #include "chrome/browser/pref_service.h" | 13 #include "chrome/browser/pref_service.h" |
| 13 #include "chrome/browser/profile.h" | 14 #include "chrome/browser/profile.h" |
| 14 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
| 15 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 16 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 return l10n_util::GetString(IDS_AUTOFILL_CC_INFOBAR_ACCEPT); | 74 return l10n_util::GetString(IDS_AUTOFILL_CC_INFOBAR_ACCEPT); |
| 74 else if (button == BUTTON_CANCEL) | 75 else if (button == BUTTON_CANCEL) |
| 75 return l10n_util::GetString(IDS_AUTOFILL_CC_INFOBAR_DENY); | 76 return l10n_util::GetString(IDS_AUTOFILL_CC_INFOBAR_DENY); |
| 76 else | 77 else |
| 77 NOTREACHED(); | 78 NOTREACHED(); |
| 78 | 79 |
| 79 return std::wstring(); | 80 return std::wstring(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 bool AutoFillCCInfoBarDelegate::Accept() { | 83 bool AutoFillCCInfoBarDelegate::Accept() { |
| 84 UMA_HISTOGRAM_COUNTS("AutoFill.CCInfoBarAccepted", 1); | |
|
jar (doing other things)
2010/09/17 16:43:11
Rather than using two separate histograms, you sho
| |
| 83 if (host_) { | 85 if (host_) { |
| 84 host_->OnInfoBarClosed(true); | 86 host_->OnInfoBarClosed(true); |
| 85 host_ = NULL; | 87 host_ = NULL; |
| 86 } | 88 } |
| 87 return true; | 89 return true; |
| 88 } | 90 } |
| 89 | 91 |
| 90 bool AutoFillCCInfoBarDelegate::Cancel() { | 92 bool AutoFillCCInfoBarDelegate::Cancel() { |
| 93 UMA_HISTOGRAM_COUNTS("AutoFill.CCInfoBarDenied", 1); | |
| 91 if (host_) { | 94 if (host_) { |
| 92 host_->OnInfoBarClosed(false); | 95 host_->OnInfoBarClosed(false); |
| 93 host_ = NULL; | 96 host_ = NULL; |
| 94 } | 97 } |
| 95 return true; | 98 return true; |
| 96 } | 99 } |
| 97 | 100 |
| 98 std::wstring AutoFillCCInfoBarDelegate::GetLinkText() { | 101 std::wstring AutoFillCCInfoBarDelegate::GetLinkText() { |
| 99 return l10n_util::GetString(IDS_AUTOFILL_CC_LEARN_MORE); | 102 return l10n_util::GetString(IDS_AUTOFILL_CC_LEARN_MORE); |
| 100 } | 103 } |
| 101 | 104 |
| 102 bool AutoFillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 105 bool AutoFillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
| 103 browser_->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(), NEW_FOREGROUND_TAB, | 106 browser_->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(), NEW_FOREGROUND_TAB, |
| 104 PageTransition::TYPED); | 107 PageTransition::TYPED); |
| 105 return false; | 108 return false; |
| 106 } | 109 } |
| 107 | 110 |
| 108 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 109 InfoBar* AutoFillCCInfoBarDelegate::CreateInfoBar() { | 112 InfoBar* AutoFillCCInfoBarDelegate::CreateInfoBar() { |
| 110 return CreateAutofillCcInfoBar(this); | 113 return CreateAutofillCcInfoBar(this); |
| 111 } | 114 } |
| 112 #endif // defined(OS_WIN) | 115 #endif // defined(OS_WIN) |
| 113 | 116 |
| OLD | NEW |