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_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 | 65 |
66 RegisterProtocolHandlerInfoBarDelegate* | 66 RegisterProtocolHandlerInfoBarDelegate* |
67 RegisterProtocolHandlerInfoBarDelegate:: | 67 RegisterProtocolHandlerInfoBarDelegate:: |
68 AsRegisterProtocolHandlerInfoBarDelegate() { | 68 AsRegisterProtocolHandlerInfoBarDelegate() { |
69 return this; | 69 return this; |
70 } | 70 } |
71 | 71 |
72 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetMessageText() const { | 72 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetMessageText() const { |
73 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); | 73 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); |
74 return old_handler.IsEmpty() ? | 74 return old_handler.IsEmpty() ? |
75 l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, | 75 l10n_util::GetStringFUTF16( |
76 handler_.title(), base::UTF8ToUTF16(handler_.url().host()), | 76 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, |
jochen (gone - plz use gerrit)
2014/05/06 18:38:30
is title() used anywhere else? Otherwise, you shou
meacer
2014/05/06 18:46:50
I was actually looking at it now: The content sett
| |
77 base::UTF8ToUTF16(handler_.url().host()), | |
77 GetProtocolName(handler_)) : | 78 GetProtocolName(handler_)) : |
78 l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE, | 79 l10n_util::GetStringFUTF16( |
79 handler_.title(), base::UTF8ToUTF16(handler_.url().host()), | 80 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE, |
81 base::UTF8ToUTF16(handler_.url().host()), | |
80 GetProtocolName(handler_), old_handler.title()); | 82 GetProtocolName(handler_), old_handler.title()); |
81 } | 83 } |
82 | 84 |
83 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetButtonLabel( | 85 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetButtonLabel( |
84 InfoBarButton button) const { | 86 InfoBarButton button) const { |
85 return (button == BUTTON_OK) ? | 87 return (button == BUTTON_OK) ? |
86 l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT, | 88 l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT, |
87 handler_.title()) : | 89 handler_.title()) : |
88 l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_DENY); | 90 l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_DENY); |
89 } | 91 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 } | 127 } |
126 | 128 |
127 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetProtocolName( | 129 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetProtocolName( |
128 const ProtocolHandler& handler) const { | 130 const ProtocolHandler& handler) const { |
129 if (handler.protocol() == "mailto") | 131 if (handler.protocol() == "mailto") |
130 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME); | 132 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME); |
131 if (handler.protocol() == "webcal") | 133 if (handler.protocol() == "webcal") |
132 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME); | 134 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME); |
133 return base::UTF8ToUTF16(handler.protocol()); | 135 return base::UTF8ToUTF16(handler.protocol()); |
134 } | 136 } |
OLD | NEW |