OLD | NEW |
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/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/strings/utf_string_conversions.h" | 7 #include "base/strings/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/infobars/infobar.h" | 9 #include "chrome/browser/infobars/infobar.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 | 109 |
110 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetLinkText() const { | 110 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetLinkText() const { |
111 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 111 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
112 } | 112 } |
113 | 113 |
114 bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked( | 114 bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked( |
115 WindowOpenDisposition disposition) { | 115 WindowOpenDisposition disposition) { |
116 content::RecordAction( | 116 content::RecordAction( |
117 base::UserMetricsAction("RegisterProtocolHandler.InfoBar_LearnMore")); | 117 base::UserMetricsAction("RegisterProtocolHandler.InfoBar_LearnMore")); |
118 web_contents()->OpenURL(content::OpenURLParams( | 118 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
119 GURL(chrome::kLearnMoreRegisterProtocolHandlerURL), content::Referrer(), | 119 content::OpenURLParams( |
120 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 120 GURL(chrome::kLearnMoreRegisterProtocolHandlerURL), |
121 content::PAGE_TRANSITION_LINK, false)); | 121 content::Referrer(), |
| 122 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 123 content::PAGE_TRANSITION_LINK, false)); |
122 return false; | 124 return false; |
123 } | 125 } |
124 | 126 |
125 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetProtocolName( | 127 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetProtocolName( |
126 const ProtocolHandler& handler) const { | 128 const ProtocolHandler& handler) const { |
127 if (handler.protocol() == "mailto") | 129 if (handler.protocol() == "mailto") |
128 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME); | 130 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME); |
129 if (handler.protocol() == "webcal") | 131 if (handler.protocol() == "webcal") |
130 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME); | 132 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME); |
131 return base::UTF8ToUTF16(handler.protocol()); | 133 return base::UTF8ToUTF16(handler.protocol()); |
132 } | 134 } |
OLD | NEW |