diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-03 21:33:21 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-03 21:33:21 +0000 |
commit | 10f57b9be42b705fd1bed1a97acd90c8c885c396 (patch) | |
tree | 77d5fbbace6a41dc28ace3b4f573fc917aae61da /chrome/browser/external_protocol_handler.cc | |
parent | df891031f2d5bd26eccd180fea4deb4797dd7a60 (diff) | |
download | chromium_src-10f57b9be42b705fd1bed1a97acd90c8c885c396.zip chromium_src-10f57b9be42b705fd1bed1a97acd90c8c885c396.tar.gz chromium_src-10f57b9be42b705fd1bed1a97acd90c8c885c396.tar.bz2 |
Add external protocol dialog for Linux.
This exposes a bug where \n in a string resource is rendered literally when it is displayed. I don't know at what point on Windows the '\' + 'n' is translated to a line return, I have filed crbug.com/20943
BUG=20731
Review URL: http://codereview.chromium.org/194002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_protocol_handler.cc')
-rw-r--r-- | chrome/browser/external_protocol_handler.cc | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/chrome/browser/external_protocol_handler.cc b/chrome/browser/external_protocol_handler.cc index 59f7a23..3bfbb6e6 100644 --- a/chrome/browser/external_protocol_handler.cc +++ b/chrome/browser/external_protocol_handler.cc @@ -20,10 +20,6 @@ #include "googleurl/src/gurl.h" #include "net/base/escape.h" -#if defined(OS_WIN) -#include "chrome/browser/views/external_protocol_dialog.h" -#endif - // static void ExternalProtocolHandler::PrepopulateDictionary(DictionaryValue* win_pref) { static bool is_warm = false; @@ -116,36 +112,27 @@ void ExternalProtocolHandler::LaunchUrl(const GURL& url, if (block_state == BLOCK) return; -#if defined(OS_WIN) if (block_state == UNKNOWN) { - std::wstring command = ExternalProtocolDialog::GetApplicationForProtocol( - escaped_url); - if (command.empty()) { - // ShellExecute won't do anything. Don't bother warning the user. - return; - } - +#if !defined(OS_MACOSX) // Ask the user if they want to allow the protocol. This will call // LaunchUrlWithoutSecurityCheck if the user decides to accept the protocol. - ExternalProtocolDialog::RunExternalProtocolDialog(escaped_url, - command, - render_process_host_id, - tab_contents_id); + RunExternalProtocolDialog(escaped_url, + render_process_host_id, + tab_contents_id); +#endif + // For now, allow only whitelisted protocols to fire on Mac. + // See http://crbug.com/15546. return; } -#else - // For now, allow only whitelisted protocols to fire. - // TODO(port): implement dialog for Mac/Linux. - // See http://code.google.com/p/chromium/issues/detail?id=20731 - // and http://code.google.com/p/chromium/issues/detail?id=15546. - if (block_state == UNKNOWN) - return; -#endif - // Otherwise the protocol is white-listed, so go ahead and launch. + LaunchUrlWithoutSecurityCheck(escaped_url); +} + +// static +void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) { #if defined(OS_MACOSX) // This must run on the main thread on OS X. - LaunchUrlWithoutSecurityCheck(escaped_url); + platform_util::OpenExternal(url); #else // Otherwise put this work on the file thread. On Windows ShellExecute may // block for a significant amount of time, and it shouldn't hurt on Linux. @@ -155,18 +142,11 @@ void ExternalProtocolHandler::LaunchUrl(const GURL& url, } loop->PostTask(FROM_HERE, - NewRunnableFunction( - &ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck, - escaped_url)); + NewRunnableFunction(&platform_util::OpenExternal, url)); #endif } // static -void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) { - platform_util::OpenExternal(url); -} - -// static void ExternalProtocolHandler::RegisterPrefs(PrefService* prefs) { prefs->RegisterDictionaryPref(prefs::kExcludedSchemes); } |