| OLD | NEW |
| 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/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" | 5 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 9 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "content/browser/tab_contents/tab_contents.h" | 11 #include "content/browser/tab_contents/tab_contents.h" |
| 12 #include "content/browser/user_metrics.h" |
| 12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 | 15 |
| 15 RegisterProtocolHandlerInfoBarDelegate::RegisterProtocolHandlerInfoBarDelegate( | 16 RegisterProtocolHandlerInfoBarDelegate::RegisterProtocolHandlerInfoBarDelegate( |
| 16 TabContents* tab_contents, | 17 TabContents* tab_contents, |
| 17 ProtocolHandlerRegistry* registry, | 18 ProtocolHandlerRegistry* registry, |
| 18 const ProtocolHandler& handler) | 19 const ProtocolHandler& handler) |
| 19 : ConfirmInfoBarDelegate(tab_contents), | 20 : ConfirmInfoBarDelegate(tab_contents), |
| 20 tab_contents_(tab_contents), | 21 tab_contents_(tab_contents), |
| 21 registry_(registry), | 22 registry_(registry), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 handler_.title()) : | 63 handler_.title()) : |
| 63 l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_DENY); | 64 l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_DENY); |
| 64 } | 65 } |
| 65 | 66 |
| 66 bool RegisterProtocolHandlerInfoBarDelegate::NeedElevation( | 67 bool RegisterProtocolHandlerInfoBarDelegate::NeedElevation( |
| 67 InfoBarButton button) const { | 68 InfoBarButton button) const { |
| 68 return button == BUTTON_OK; | 69 return button == BUTTON_OK; |
| 69 } | 70 } |
| 70 | 71 |
| 71 bool RegisterProtocolHandlerInfoBarDelegate::Accept() { | 72 bool RegisterProtocolHandlerInfoBarDelegate::Accept() { |
| 73 UserMetrics::RecordAction(UserMetricsAction( |
| 74 "RegisterProtocolHandler.Infobar_Accept")); |
| 72 registry_->OnAcceptRegisterProtocolHandler(handler_); | 75 registry_->OnAcceptRegisterProtocolHandler(handler_); |
| 73 return true; | 76 return true; |
| 74 } | 77 } |
| 75 | 78 |
| 76 bool RegisterProtocolHandlerInfoBarDelegate::Cancel() { | 79 bool RegisterProtocolHandlerInfoBarDelegate::Cancel() { |
| 80 UserMetrics::RecordAction(UserMetricsAction( |
| 81 "RegisterProtocolHandler.InfoBar_Deny")); |
| 77 registry_->OnIgnoreRegisterProtocolHandler(handler_); | 82 registry_->OnIgnoreRegisterProtocolHandler(handler_); |
| 78 return true; | 83 return true; |
| 79 } | 84 } |
| 80 | 85 |
| 81 string16 RegisterProtocolHandlerInfoBarDelegate::GetLinkText() const { | 86 string16 RegisterProtocolHandlerInfoBarDelegate::GetLinkText() const { |
| 82 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 87 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 83 } | 88 } |
| 84 | 89 |
| 85 bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked( | 90 bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked( |
| 86 WindowOpenDisposition disposition) { | 91 WindowOpenDisposition disposition) { |
| 92 UserMetrics::RecordAction(UserMetricsAction( |
| 93 "RegisterProtocolHandler.InfoBar_LearnMore")); |
| 87 tab_contents_->OpenURL(google_util::AppendGoogleLocaleParam(GURL( | 94 tab_contents_->OpenURL(google_util::AppendGoogleLocaleParam(GURL( |
| 88 chrome::kLearnMoreRegisterProtocolHandlerURL)), GURL(), | 95 chrome::kLearnMoreRegisterProtocolHandlerURL)), GURL(), |
| 89 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 96 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 90 PageTransition::LINK); | 97 PageTransition::LINK); |
| 91 return false; | 98 return false; |
| 92 } | 99 } |
| OLD | NEW |