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

Side by Side Diff: chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc

Issue 267103002: Ignore title parameter for navigator.registerProtocolHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 6 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) 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
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,
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,
80 GetProtocolName(handler_), old_handler.title()); 81 base::UTF8ToUTF16(handler_.url().host()),
82 GetProtocolName(handler_),
83 base::UTF8ToUTF16(old_handler.url().host()));
81 } 84 }
82 85
83 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetButtonLabel( 86 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetButtonLabel(
84 InfoBarButton button) const { 87 InfoBarButton button) const {
85 return (button == BUTTON_OK) ? 88 return (button == BUTTON_OK) ?
86 l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT, 89 l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT) :
87 handler_.title()) :
88 l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_DENY); 90 l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_DENY);
89 } 91 }
90 92
91 bool RegisterProtocolHandlerInfoBarDelegate::OKButtonTriggersUACPrompt() const { 93 bool RegisterProtocolHandlerInfoBarDelegate::OKButtonTriggersUACPrompt() const {
92 return true; 94 return true;
93 } 95 }
94 96
95 bool RegisterProtocolHandlerInfoBarDelegate::Accept() { 97 bool RegisterProtocolHandlerInfoBarDelegate::Accept() {
96 content::RecordAction( 98 content::RecordAction(
97 base::UserMetricsAction("RegisterProtocolHandler.Infobar_Accept")); 99 base::UserMetricsAction("RegisterProtocolHandler.Infobar_Accept"));
(...skipping 26 matching lines...) Expand all
124 } 126 }
125 127
126 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetProtocolName( 128 base::string16 RegisterProtocolHandlerInfoBarDelegate::GetProtocolName(
127 const ProtocolHandler& handler) const { 129 const ProtocolHandler& handler) const {
128 if (handler.protocol() == "mailto") 130 if (handler.protocol() == "mailto")
129 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME); 131 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME);
130 if (handler.protocol() == "webcal") 132 if (handler.protocol() == "webcal")
131 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME); 133 return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME);
132 return base::UTF8ToUTF16(handler.protocol()); 134 return base::UTF8ToUTF16(handler.protocol());
133 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698