summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormeacer@chromium.org <meacer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-10 20:39:06 +0000
committermeacer@chromium.org <meacer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-10 20:39:06 +0000
commitc125e533bf1242460089f62ac305a99e1f95f7a0 (patch)
tree93d1da890a72920fd6cdbdd7308274d6c720dcaf
parentdcfcf94f4dc710e260d8783c7aac30b5e0756431 (diff)
downloadchromium_src-c125e533bf1242460089f62ac305a99e1f95f7a0.zip
chromium_src-c125e533bf1242460089f62ac305a99e1f95f7a0.tar.gz
chromium_src-c125e533bf1242460089f62ac305a99e1f95f7a0.tar.bz2
Ignore title parameter for navigator.registerProtocolHandler
BUG=347720 Review URL: https://codereview.chromium.org/267103002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269630 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd18
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry.cc6
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc13
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc85
-rw-r--r--chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc16
-rw-r--r--chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc19
-rw-r--r--chrome/browser/prerender/prerender_contents.cc1
-rw-r--r--chrome/browser/renderer_context_menu/render_view_context_menu.cc2
-rw-r--r--chrome/browser/resources/options/handler_options_list.js16
-rw-r--r--chrome/browser/ui/browser.cc3
-rw-r--r--chrome/browser/ui/browser.h1
-rw-r--r--chrome/browser/ui/content_settings/content_setting_bubble_model.cc9
-rw-r--r--chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc9
-rw-r--r--chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc3
-rw-r--r--chrome/browser/ui/webui/options/handler_options_handler.cc9
-rw-r--r--chrome/common/custom_handlers/protocol_handler.cc27
-rw-r--r--chrome/common/custom_handlers/protocol_handler.h10
-rw-r--r--content/browser/web_contents/web_contents_impl.cc2
-rw-r--r--content/public/browser/web_contents_delegate.h1
19 files changed, 103 insertions, 147 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 5ae2ccf..cc61601 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -12175,20 +12175,10 @@ Some features may be unavailable. Please check that the profile exists and you
https:////mail.google.com//mail//?extsrc=mailto&amp;url=%s
</message>
- <!-- The name for the Google mailto service. -->
- <message name="IDS_GOOGLE_MAILTO_HANDLER_NAME">
- Google.com Mail
- </message>
-
<!-- The URL for the Google webcal service. -->
<message name="IDS_GOOGLE_WEBCAL_HANDLER_URL">
https:////www.google.com//calendar//render?cid=%s
</message>
-
- <!-- The name for the Google webcal service. -->
- <message name="IDS_GOOGLE_WEBCAL_HANDLER_NAME">
- Google Calendar
- </message>
</if>
<!-- Translate Info Bar -->
@@ -13114,10 +13104,10 @@ Some features may be unavailable. Please check that the profile exists and you
web calendar
</message>
<message name="IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM" desc="The message to display when asking a user to confirm the registration of a protocol handler.">
- Allow <ph name="HANDLER_TITLE">$1<ex>Google Search</ex></ph> (<ph name="HANDLER_HOSTNAME">$2<ex>google.com</ex></ph>) to open all <ph name="PROTOCOL">$3<ex>search</ex></ph> links?
+ Allow <ph name="HANDLER_HOSTNAME">$1<ex>google.com</ex></ph> to open all <ph name="PROTOCOL">$2<ex>search</ex></ph> links?
</message>
<message name="IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE" desc="The message to display when asking a user to confirm the registration of a protocol handler.">
- Allow <ph name="HANDLER_TITLE">$1<ex>Google Search</ex></ph> (<ph name="HANDLER_HOSTNAME">$2<ex>google.com</ex></ph>) to open all <ph name="PROTOCOL">$3<ex>search</ex></ph> links instead of <ph name="REPLACED_HANDLER_TITLE">$4<ex>Elgoog Search</ex></ph>?
+ Allow <ph name="HANDLER_HOSTNAME">$1<ex>google.com</ex></ph> to open all <ph name="PROTOCOL">$2<ex>search</ex></ph> links instead of <ph name="REPLACED_HANDLER_TITLE">$3<ex>Elgoog Search</ex></ph>?
</message>
<message name="IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_FRAGMENT" desc="The permission fragment to display when asking a user to confirm the registration of a protocol handler in a permission bubble. Follows a prompt 'This site would like to:'.">
<ph name="PROTOCOL">$3<ex>search</ex></ph> links
@@ -13126,10 +13116,10 @@ Some features may be unavailable. Please check that the profile exists and you
<ph name="PROTOCOL">$3<ex>search</ex></ph> links instead of <ph name="REPLACED_HANDLER_TITLE">$4<ex>Elgoog Search</ex></ph>
</message>
<message name="IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT" desc="Text to show for the accept button for the register protocol handler request infobar.">
- Use <ph name="HANDLER_TITLE">$1<ex>Google Search</ex></ph>
+ Allow
</message>
<message name="IDS_REGISTER_PROTOCOL_HANDLER_DENY" desc="Text to show for the deny button for the register protocol handler request infobar.">
- No
+ Deny
</message>
<message name="IDS_REGISTER_PROTOCOL_HANDLER_IGNORE" desc="Text to show for an ignore prompt for a register protocol handler registration request.">
Ignore
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index 333f3e5..3ceffb0 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -418,13 +418,11 @@ void ProtocolHandlerRegistry::InstallDefaultsForChromeOS() {
AddPredefinedHandler(
ProtocolHandler::CreateProtocolHandler(
"mailto",
- GURL(l10n_util::GetStringUTF8(IDS_GOOGLE_MAILTO_HANDLER_URL)),
- l10n_util::GetStringUTF16(IDS_GOOGLE_MAILTO_HANDLER_NAME)));
+ GURL(l10n_util::GetStringUTF8(IDS_GOOGLE_MAILTO_HANDLER_URL))));
AddPredefinedHandler(
ProtocolHandler::CreateProtocolHandler(
"webcal",
- GURL(l10n_util::GetStringUTF8(IDS_GOOGLE_WEBCAL_HANDLER_URL)),
- l10n_util::GetStringUTF16(IDS_GOOGLE_WEBCAL_HANDLER_NAME)));
+ GURL(l10n_util::GetStringUTF8(IDS_GOOGLE_WEBCAL_HANDLER_URL))));
#else
NOTREACHED(); // this method should only ever be called in chromeos.
#endif
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc
index ff797a7..cd4f791 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc
@@ -46,10 +46,9 @@ class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest {
}
void AddProtocolHandler(const std::string& protocol,
- const GURL& url,
- const base::string16& title) {
- ProtocolHandler handler = ProtocolHandler::CreateProtocolHandler(
- protocol, url, title);
+ const GURL& url) {
+ ProtocolHandler handler = ProtocolHandler::CreateProtocolHandler(protocol,
+ url);
ProtocolHandlerRegistry* registry =
ProtocolHandlerRegistryFactory::GetForProfile(browser()->profile());
// Fake that this registration is happening on profile startup. Otherwise
@@ -69,8 +68,7 @@ IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest,
ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKWITH));
AddProtocolHandler(std::string("web+search"),
- GURL("http://www.google.com/%s"),
- base::UTF8ToUTF16(std::string("Test handler")));
+ GURL("http://www.google.com/%s"));
GURL url("web+search:testing");
ProtocolHandlerRegistry* registry =
ProtocolHandlerRegistryFactory::GetForProfile(browser()->profile());
@@ -82,8 +80,7 @@ IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest,
IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, CustomHandler) {
ASSERT_TRUE(test_server()->Start());
GURL handler_url = test_server()->GetURL("files/custom_handler_foo.html");
- AddProtocolHandler("foo", handler_url,
- base::UTF8ToUTF16(std::string("Test foo Handler")));
+ AddProtocolHandler("foo", handler_url);
ui_test_utils::NavigateToURL(browser(), GURL("foo:test"));
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index a3783da..16d8fc7 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -320,16 +320,13 @@ class ProtocolHandlerRegistryTest : public testing::Test {
}
ProtocolHandler CreateProtocolHandler(const std::string& protocol,
- const GURL& url,
- const std::string& title) {
- return ProtocolHandler::CreateProtocolHandler(protocol, url,
- base::UTF8ToUTF16(title));
+ const GURL& url) {
+ return ProtocolHandler::CreateProtocolHandler(protocol, url);
}
ProtocolHandler CreateProtocolHandler(const std::string& protocol,
- const std::string& name) {
- return CreateProtocolHandler(protocol, GURL("http://" + name + "/%s"),
- name);
+ const std::string& name) {
+ return CreateProtocolHandler(protocol, GURL("http://" + name + "/%s"));
}
void RecreateRegistry(bool initialize) {
@@ -356,7 +353,7 @@ class ProtocolHandlerRegistryTest : public testing::Test {
CHECK(profile_->GetPrefs());
SetUpRegistry(true);
test_protocol_handler_ =
- CreateProtocolHandler("test", GURL("http://test.com/%s"), "Test");
+ CreateProtocolHandler("test", GURL("http://test.com/%s"));
}
virtual void TearDown() {
@@ -448,10 +445,8 @@ TEST_F(ProtocolHandlerRegistryTest, IgnoreProtocolHandler) {
}
TEST_F(ProtocolHandlerRegistryTest, IgnoreEquivalentProtocolHandler) {
- ProtocolHandler ph1 = CreateProtocolHandler("test", GURL("http://test/%s"),
- "test1");
- ProtocolHandler ph2 = CreateProtocolHandler("test", GURL("http://test/%s"),
- "test2");
+ ProtocolHandler ph1 = CreateProtocolHandler("test", GURL("http://test/%s"));
+ ProtocolHandler ph2 = CreateProtocolHandler("test", GURL("http://test/%s"));
registry()->OnIgnoreRegisterProtocolHandler(ph1);
ASSERT_TRUE(registry()->IsIgnored(ph1));
@@ -588,10 +583,8 @@ TEST_F(ProtocolHandlerRegistryTest, TestIsRegistered) {
}
TEST_F(ProtocolHandlerRegistryTest, TestIsEquivalentRegistered) {
- ProtocolHandler ph1 = CreateProtocolHandler("test", GURL("http://test/%s"),
- "test1");
- ProtocolHandler ph2 = CreateProtocolHandler("test", GURL("http://test/%s"),
- "test2");
+ ProtocolHandler ph1 = CreateProtocolHandler("test", GURL("http://test/%s"));
+ ProtocolHandler ph2 = CreateProtocolHandler("test", GURL("http://test/%s"));
registry()->OnAcceptRegisterProtocolHandler(ph1);
ASSERT_TRUE(registry()->IsRegistered(ph1));
@@ -599,14 +592,10 @@ TEST_F(ProtocolHandlerRegistryTest, TestIsEquivalentRegistered) {
}
TEST_F(ProtocolHandlerRegistryTest, TestSilentlyRegisterHandler) {
- ProtocolHandler ph1 = CreateProtocolHandler("test", GURL("http://test/%s"),
- "test1");
- ProtocolHandler ph2 = CreateProtocolHandler("test", GURL("http://test/%s"),
- "test2");
- ProtocolHandler ph3 = CreateProtocolHandler("ignore", GURL("http://test/%s"),
- "ignore1");
- ProtocolHandler ph4 = CreateProtocolHandler("ignore", GURL("http://test/%s"),
- "ignore2");
+ ProtocolHandler ph1 = CreateProtocolHandler("test", GURL("http://test/1/%s"));
+ ProtocolHandler ph2 = CreateProtocolHandler("test", GURL("http://test/2/%s"));
+ ProtocolHandler ph3 = CreateProtocolHandler("ignore", GURL("http://test/%s"));
+ ProtocolHandler ph4 = CreateProtocolHandler("ignore", GURL("http://test/%s"));
ASSERT_FALSE(registry()->SilentlyHandleRegisterHandlerRequest(ph1));
ASSERT_FALSE(registry()->IsRegistered(ph1));
@@ -859,10 +848,10 @@ TEST_F(ProtocolHandlerRegistryTest, TestLoadEnabledGetsPropogatedToIO) {
}
TEST_F(ProtocolHandlerRegistryTest, TestReplaceHandler) {
- ProtocolHandler ph1 = CreateProtocolHandler("mailto",
- GURL("http://test.com/%s"), "test1");
- ProtocolHandler ph2 = CreateProtocolHandler("mailto",
- GURL("http://test.com/updated-url/%s"), "test2");
+ ProtocolHandler ph1 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/%s"));
+ ProtocolHandler ph2 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/updated-url/%s"));
registry()->OnAcceptRegisterProtocolHandler(ph1);
ASSERT_TRUE(registry()->AttemptReplace(ph2));
const ProtocolHandler& handler(registry()->GetHandlerFor("mailto"));
@@ -870,12 +859,12 @@ TEST_F(ProtocolHandlerRegistryTest, TestReplaceHandler) {
}
TEST_F(ProtocolHandlerRegistryTest, TestReplaceNonDefaultHandler) {
- ProtocolHandler ph1 = CreateProtocolHandler("mailto",
- GURL("http://test.com/%s"), "test1");
- ProtocolHandler ph2 = CreateProtocolHandler("mailto",
- GURL("http://test.com/updated-url/%s"), "test2");
- ProtocolHandler ph3 = CreateProtocolHandler("mailto",
- GURL("http://else.com/%s"), "test3");
+ ProtocolHandler ph1 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/%s"));
+ ProtocolHandler ph2 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/updated-url/%s"));
+ ProtocolHandler ph3 =
+ CreateProtocolHandler("mailto", GURL("http://else.com/%s"));
registry()->OnAcceptRegisterProtocolHandler(ph1);
registry()->OnAcceptRegisterProtocolHandler(ph3);
ASSERT_TRUE(registry()->AttemptReplace(ph2));
@@ -884,12 +873,12 @@ TEST_F(ProtocolHandlerRegistryTest, TestReplaceNonDefaultHandler) {
}
TEST_F(ProtocolHandlerRegistryTest, TestReplaceRemovesStaleHandlers) {
- ProtocolHandler ph1 = CreateProtocolHandler("mailto",
- GURL("http://test.com/%s"), "test1");
- ProtocolHandler ph2 = CreateProtocolHandler("mailto",
- GURL("http://test.com/updated-url/%s"), "test2");
- ProtocolHandler ph3 = CreateProtocolHandler("mailto",
- GURL("http://test.com/third/%s"), "test");
+ ProtocolHandler ph1 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/%s"));
+ ProtocolHandler ph2 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/updated-url/%s"));
+ ProtocolHandler ph3 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/third/%s"));
registry()->OnAcceptRegisterProtocolHandler(ph1);
registry()->OnAcceptRegisterProtocolHandler(ph2);
@@ -902,12 +891,12 @@ TEST_F(ProtocolHandlerRegistryTest, TestReplaceRemovesStaleHandlers) {
}
TEST_F(ProtocolHandlerRegistryTest, TestIsSameOrigin) {
- ProtocolHandler ph1 = CreateProtocolHandler("mailto",
- GURL("http://test.com/%s"), "test1");
- ProtocolHandler ph2 = CreateProtocolHandler("mailto",
- GURL("http://test.com/updated-url/%s"), "test2");
- ProtocolHandler ph3 = CreateProtocolHandler("mailto",
- GURL("http://other.com/%s"), "test");
+ ProtocolHandler ph1 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/%s"));
+ ProtocolHandler ph2 =
+ CreateProtocolHandler("mailto", GURL("http://test.com/updated-url/%s"));
+ ProtocolHandler ph3 =
+ CreateProtocolHandler("mailto", GURL("http://other.com/%s"));
ASSERT_EQ(ph1.url().GetOrigin() == ph2.url().GetOrigin(),
ph1.IsSameOrigin(ph2));
ASSERT_EQ(ph1.url().GetOrigin() == ph2.url().GetOrigin(),
@@ -920,8 +909,8 @@ TEST_F(ProtocolHandlerRegistryTest, TestIsSameOrigin) {
TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestInstallDefaultHandler) {
RecreateRegistry(false);
- registry()->AddPredefinedHandler(CreateProtocolHandler(
- "test", GURL("http://test.com/%s"), "Test"));
+ registry()->AddPredefinedHandler(
+ CreateProtocolHandler("test", GURL("http://test.com/%s")));
registry()->InitProtocolSettings();
std::vector<std::string> protocols;
registry()->GetRegisteredProtocols(&protocols);
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc
index d37f9ae..669a783 100644
--- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc
+++ b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc
@@ -72,19 +72,21 @@ RegisterProtocolHandlerInfoBarDelegate*
base::string16 RegisterProtocolHandlerInfoBarDelegate::GetMessageText() const {
ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol());
return old_handler.IsEmpty() ?
- l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM,
- handler_.title(), base::UTF8ToUTF16(handler_.url().host()),
+ l10n_util::GetStringFUTF16(
+ IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM,
+ base::UTF8ToUTF16(handler_.url().host()),
GetProtocolName(handler_)) :
- l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE,
- handler_.title(), base::UTF8ToUTF16(handler_.url().host()),
- GetProtocolName(handler_), old_handler.title());
+ l10n_util::GetStringFUTF16(
+ IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE,
+ base::UTF8ToUTF16(handler_.url().host()),
+ GetProtocolName(handler_),
+ base::UTF8ToUTF16(old_handler.url().host()));
}
base::string16 RegisterProtocolHandlerInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
return (button == BUTTON_OK) ?
- l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT,
- handler_.title()) :
+ l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT) :
l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_DENY);
}
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc
index 11c206f..e12b0a2 100644
--- a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc
+++ b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc
@@ -46,23 +46,28 @@ base::string16
RegisterProtocolHandlerPermissionRequest::GetMessageText() const {
ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol());
return old_handler.IsEmpty() ?
- l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM,
- handler_.title(), base::UTF8ToUTF16(handler_.url().host()),
+ l10n_util::GetStringFUTF16(
+ IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM,
+ base::UTF8ToUTF16(handler_.url().host()),
GetProtocolName(handler_)) :
- l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE,
- handler_.title(), base::UTF8ToUTF16(handler_.url().host()),
- GetProtocolName(handler_), old_handler.title());
+ l10n_util::GetStringFUTF16(
+ IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE,
+ base::UTF8ToUTF16(handler_.url().host()),
+ GetProtocolName(handler_),
+ base::UTF8ToUTF16(old_handler.url().host()));
}
base::string16
RegisterProtocolHandlerPermissionRequest::GetMessageTextFragment() const {
ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol());
return old_handler.IsEmpty() ?
- l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_FRAGMENT,
+ l10n_util::GetStringFUTF16(
+ IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_FRAGMENT,
GetProtocolName(handler_)) :
l10n_util::GetStringFUTF16(
IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE_FRAGMENT,
- GetProtocolName(handler_), old_handler.title());
+ GetProtocolName(handler_),
+ base::UTF8ToUTF16(old_handler.url().host()));
}
bool RegisterProtocolHandlerPermissionRequest::HasUserGesture() const {
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 25b6c0e..35f45a4 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -178,7 +178,6 @@ class PrerenderContents::WebContentsDelegateImpl
virtual void RegisterProtocolHandler(WebContents* web_contents,
const std::string& protocol,
const GURL& url,
- const base::string16& title,
bool user_gesture) OVERRIDE {
// TODO(mmenke): Consider supporting this if it is a common case during
// prerenders.
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 2669074..8cb1649 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -1064,7 +1064,7 @@ void RenderViewContextMenu::AppendProtocolHandlerSubMenu() {
for (size_t i = 0; i < handlers.size() && i <= max; i++) {
protocol_handler_submenu_model_.AddItem(
IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST + i,
- handlers[i].title());
+ base::UTF8ToUTF16(handlers[i].url().host()));
}
protocol_handler_submenu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
protocol_handler_submenu_model_.AddItem(
diff --git a/chrome/browser/resources/options/handler_options_list.js b/chrome/browser/resources/options/handler_options_list.js
index fef1740..12129a8 100644
--- a/chrome/browser/resources/options/handler_options_list.js
+++ b/chrome/browser/resources/options/handler_options_list.js
@@ -13,7 +13,7 @@ cr.define('options', function() {
* Creates a new ignored protocol / content handler list item.
*
* Accepts values in the form
- * ['mailto', 'http://www.thesite.com/%s', 'The title of the protocol'],
+ * ['mailto', 'http://www.thesite.com/%s', 'www.thesite.com'],
* @param {Object} entry A dictionary describing the handlers for a given
* protocol.
* @constructor
@@ -40,12 +40,12 @@ cr.define('options', function() {
protocolElement.className = 'handlers-type-column';
this.contentElement_.appendChild(protocolElement);
- // Site title.
- var titleElement = document.createElement('div');
- titleElement.textContent = this.dataItem[2];
- titleElement.className = 'handlers-site-column';
- titleElement.title = this.dataItem[1];
- this.contentElement_.appendChild(titleElement);
+ // Host name.
+ var hostElement = document.createElement('div');
+ hostElement.textContent = this.dataItem[2];
+ hostElement.className = 'handlers-site-column';
+ hostElement.title = this.dataItem[1];
+ this.contentElement_.appendChild(hostElement);
},
};
@@ -90,7 +90,7 @@ cr.define('options', function() {
* Accepts values in the form
* { protocol: 'mailto',
* handlers: [
- * ['mailto', 'http://www.thesite.com/%s', 'The title of the protocol'],
+ * ['mailto', 'http://www.thesite.com/%s', 'www.thesite.com'],
* ...,
* ],
* }
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 1411716..a06b099 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1617,7 +1617,6 @@ bool Browser::IsFullscreenForTabOrPending(
void Browser::RegisterProtocolHandler(WebContents* web_contents,
const std::string& protocol,
const GURL& url,
- const base::string16& title,
bool user_gesture) {
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
@@ -1625,7 +1624,7 @@ void Browser::RegisterProtocolHandler(WebContents* web_contents,
return;
ProtocolHandler handler =
- ProtocolHandler::CreateProtocolHandler(protocol, url, title);
+ ProtocolHandler::CreateProtocolHandler(protocol, url);
ProtocolHandlerRegistry* registry =
ProtocolHandlerRegistryFactory::GetForProfile(profile);
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 7172f5c..beb3ddd 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -616,7 +616,6 @@ class Browser : public TabStripModelObserver,
virtual void RegisterProtocolHandler(content::WebContents* web_contents,
const std::string& protocol,
const GURL& url,
- const base::string16& title,
bool user_gesture) OVERRIDE;
virtual void UpdatePreferredSize(content::WebContents* source,
const gfx::Size& pref_size) OVERRIDE;
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
index 9806d92..2acc496 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
@@ -1031,23 +1031,22 @@ ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel(
protocol = base::UTF8ToUTF16(pending_handler_.protocol());
}
+ // Note that we ignore the |title| parameter.
if (previous_handler_.IsEmpty()) {
set_title(l10n_util::GetStringFUTF8(
IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM,
- pending_handler_.title(),
base::UTF8ToUTF16(pending_handler_.url().host()),
protocol));
} else {
set_title(l10n_util::GetStringFUTF8(
IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE,
- pending_handler_.title(),
base::UTF8ToUTF16(pending_handler_.url().host()),
- protocol, previous_handler_.title()));
+ protocol,
+ base::UTF8ToUTF16(previous_handler_.url().host())));
}
std::string radio_allow_label =
- l10n_util::GetStringFUTF8(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT,
- pending_handler_.title());
+ l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT);
std::string radio_deny_label =
l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_DENY);
std::string radio_ignore_label =
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
index f6fe5f4..22fb503 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
@@ -559,8 +559,8 @@ TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) {
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents());
content_settings->set_pending_protocol_handler(
- ProtocolHandler::CreateProtocolHandler("mailto",
- GURL("http://www.toplevel.example/"), base::ASCIIToUTF16("Handler")));
+ ProtocolHandler::CreateProtocolHandler(
+ "mailto", GURL("http://www.toplevel.example/")));
ContentSettingRPHBubbleModel content_setting_bubble_model(
NULL, web_contents(), profile(), NULL,
@@ -613,8 +613,7 @@ TEST_F(ContentSettingBubbleModelTest, RPHAllow) {
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents());
ProtocolHandler test_handler = ProtocolHandler::CreateProtocolHandler(
- "mailto", GURL("http://www.toplevel.example/"),
- base::ASCIIToUTF16("Handler"));
+ "mailto", GURL("http://www.toplevel.example/"));
content_settings->set_pending_protocol_handler(test_handler);
ContentSettingRPHBubbleModel content_setting_bubble_model(
@@ -633,7 +632,6 @@ TEST_F(ContentSettingBubbleModelTest, RPHAllow) {
{
ProtocolHandler handler = registry.GetHandlerFor("mailto");
ASSERT_FALSE(handler.IsEmpty());
- EXPECT_EQ(base::ASCIIToUTF16("Handler"), handler.title());
EXPECT_EQ(CONTENT_SETTING_ALLOW,
content_settings->pending_protocol_handler_setting());
}
@@ -662,7 +660,6 @@ TEST_F(ContentSettingBubbleModelTest, RPHAllow) {
{
ProtocolHandler handler = registry.GetHandlerFor("mailto");
ASSERT_FALSE(handler.IsEmpty());
- EXPECT_EQ(base::ASCIIToUTF16("Handler"), handler.title());
EXPECT_EQ(CONTENT_SETTING_ALLOW,
content_settings->pending_protocol_handler_setting());
EXPECT_FALSE(registry.IsIgnored(test_handler));
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
index 3cf2aeb..6c75a57 100644
--- a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
@@ -86,8 +86,7 @@ TEST_F(ContentSettingImageModelTest, RPHUpdateFromWebContents) {
TabSpecificContentSettings::FromWebContents(web_contents());
content_settings->set_pending_protocol_handler(
ProtocolHandler::CreateProtocolHandler(
- "mailto", GURL("http://www.google.com/"),
- base::ASCIIToUTF16("Handler")));
+ "mailto", GURL("http://www.google.com/")));
content_setting_image_model->UpdateFromWebContents(web_contents());
EXPECT_TRUE(content_setting_image_model->is_visible());
}
diff --git a/chrome/browser/ui/webui/options/handler_options_handler.cc b/chrome/browser/ui/webui/options/handler_options_handler.cc
index 4c8dfc7..456f469 100644
--- a/chrome/browser/ui/webui/options/handler_options_handler.cc
+++ b/chrome/browser/ui/webui/options/handler_options_handler.cc
@@ -99,7 +99,7 @@ static void GetHandlersAsListValue(
base::ListValue* handlerValue = new base::ListValue();
handlerValue->Append(new base::StringValue(handler->protocol()));
handlerValue->Append(new base::StringValue(handler->url().spec()));
- handlerValue->Append(new base::StringValue(handler->title()));
+ handlerValue->Append(new base::StringValue(handler->url().host()));
handler_list->Append(handlerValue);
}
}
@@ -199,14 +199,11 @@ ProtocolHandler HandlerOptionsHandler::ParseHandlerFromArgs(
const base::ListValue* args) const {
base::string16 protocol;
base::string16 url;
- base::string16 title;
- bool ok = args->GetString(0, &protocol) && args->GetString(1, &url) &&
- args->GetString(2, &title);
+ bool ok = args->GetString(0, &protocol) && args->GetString(1, &url);
if (!ok)
return ProtocolHandler::EmptyProtocolHandler();
return ProtocolHandler::CreateProtocolHandler(base::UTF16ToUTF8(protocol),
- GURL(base::UTF16ToUTF8(url)),
- title);
+ GURL(base::UTF16ToUTF8(url)));
}
void HandlerOptionsHandler::Observe(
diff --git a/chrome/common/custom_handlers/protocol_handler.cc b/chrome/common/custom_handlers/protocol_handler.cc
index 714feb1..9b02788 100644
--- a/chrome/common/custom_handlers/protocol_handler.cc
+++ b/chrome/common/custom_handlers/protocol_handler.cc
@@ -10,27 +10,24 @@
ProtocolHandler::ProtocolHandler(const std::string& protocol,
- const GURL& url,
- const base::string16& title)
+ const GURL& url)
: protocol_(protocol),
- url_(url),
- title_(title) {
+ url_(url) {
}
ProtocolHandler ProtocolHandler::CreateProtocolHandler(
const std::string& protocol,
- const GURL& url,
- const base::string16& title) {
+ const GURL& url) {
std::string lower_protocol = StringToLowerASCII(protocol);
- return ProtocolHandler(lower_protocol, url, title);
+ return ProtocolHandler(lower_protocol, url);
}
ProtocolHandler::ProtocolHandler() {
}
bool ProtocolHandler::IsValidDict(const base::DictionaryValue* value) {
- return value->HasKey("protocol") && value->HasKey("url") &&
- value->HasKey("title");
+ // Note that "title" parameter is ignored.
+ return value->HasKey("protocol") && value->HasKey("url");
}
bool ProtocolHandler::IsSameOrigin(
@@ -49,11 +46,9 @@ ProtocolHandler ProtocolHandler::CreateProtocolHandler(
return EmptyProtocolHandler();
}
std::string protocol, url;
- base::string16 title;
value->GetString("protocol", &protocol);
value->GetString("url", &url);
- value->GetString("title", &title);
- return ProtocolHandler::CreateProtocolHandler(protocol, GURL(url), title);
+ return ProtocolHandler::CreateProtocolHandler(protocol, GURL(url));
}
GURL ProtocolHandler::TranslateUrl(const GURL& url) const {
@@ -67,7 +62,6 @@ base::DictionaryValue* ProtocolHandler::Encode() const {
base::DictionaryValue* d = new base::DictionaryValue();
d->Set("protocol", new base::StringValue(protocol_));
d->Set("url", new base::StringValue(url_.spec()));
- d->Set("title", new base::StringValue(title_));
return d;
}
@@ -75,15 +69,12 @@ base::DictionaryValue* ProtocolHandler::Encode() const {
std::string ProtocolHandler::ToString() const {
return "{ protocol=" + protocol_ +
", url=" + url_.spec() +
- ", title=" + base::UTF16ToASCII(title_) +
" }";
}
#endif
bool ProtocolHandler::operator==(const ProtocolHandler& other) const {
- return protocol_ == other.protocol_ &&
- url_ == other.url_ &&
- title_ == other.title_;
+ return protocol_ == other.protocol_ && url_ == other.url_;
}
bool ProtocolHandler::IsEquivalent(const ProtocolHandler& other) const {
@@ -91,5 +82,5 @@ bool ProtocolHandler::IsEquivalent(const ProtocolHandler& other) const {
}
bool ProtocolHandler::operator<(const ProtocolHandler& other) const {
- return title_ < other.title_;
+ return url_ < other.url_;
}
diff --git a/chrome/common/custom_handlers/protocol_handler.h b/chrome/common/custom_handlers/protocol_handler.h
index dc18be5..745a3f5 100644
--- a/chrome/common/custom_handlers/protocol_handler.h
+++ b/chrome/common/custom_handlers/protocol_handler.h
@@ -10,14 +10,13 @@
#include "base/values.h"
#include "url/gurl.h"
-// A single tuple of (protocol, url, title) that indicates how URLs of the
+// A single tuple of (protocol, url) that indicates how URLs of the
// given protocol should be rewritten to be handled.
class ProtocolHandler {
public:
static ProtocolHandler CreateProtocolHandler(const std::string& protocol,
- const GURL& url,
- const base::string16& title);
+ const GURL& url);
// Creates a ProtocolHandler with fields from the dictionary. Returns an
// empty ProtocolHandler if the input is invalid.
@@ -48,7 +47,6 @@ class ProtocolHandler {
const std::string& protocol() const { return protocol_; }
const GURL& url() const { return url_;}
- const base::string16& title() const { return title_; }
bool IsEmpty() const {
return protocol_.empty();
@@ -65,13 +63,11 @@ class ProtocolHandler {
private:
ProtocolHandler(const std::string& protocol,
- const GURL& url,
- const base::string16& title);
+ const GURL& url);
ProtocolHandler();
std::string protocol_;
GURL url_;
- base::string16 title_;
};
#endif // CHROME_COMMON_CUSTOM_HANDLERS_PROTOCOL_HANDLER_H_
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 19fadd6..7d23e8d 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2657,7 +2657,7 @@ void WebContentsImpl::OnRegisterProtocolHandler(const std::string& protocol,
if (policy->IsPseudoScheme(protocol))
return;
- delegate_->RegisterProtocolHandler(this, protocol, url, title, user_gesture);
+ delegate_->RegisterProtocolHandler(this, protocol, url, user_gesture);
}
void WebContentsImpl::OnFindReply(int request_id,
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index 0edb3bd..0193b06 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -377,7 +377,6 @@ class CONTENT_EXPORT WebContentsDelegate {
virtual void RegisterProtocolHandler(WebContents* web_contents,
const std::string& protocol,
const GURL& url,
- const base::string16& title,
bool user_gesture) {}
// Result of string search in the page. This includes the number of matches