diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-23 05:04:38 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-23 05:04:38 +0000 |
commit | 956eabbb1da6f947c8cbbc94131f3f6bdd8e93da (patch) | |
tree | 225ac2fc36bfaba4b824f297fff11620444ce164 /chrome/browser/external_protocol/external_protocol_handler.h | |
parent | 886ee30c5a5ee2a43d1532a1bf145d2c5814b0b6 (diff) | |
download | chromium_src-956eabbb1da6f947c8cbbc94131f3f6bdd8e93da.zip chromium_src-956eabbb1da6f947c8cbbc94131f3f6bdd8e93da.tar.gz chromium_src-956eabbb1da6f947c8cbbc94131f3f6bdd8e93da.tar.bz2 |
Open external application dialog should not show for Chrome.
This change prevents the external application dialog from coming up if Chrome
detects that it would just start itself. To determine this it uses the
shell_integration functionality added for registerProtocolHandler to find out
if Chrome is the default handler.
BUG=90373
TEST=Unit tests added.
Review URL: http://codereview.chromium.org/7790021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102449 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_protocol/external_protocol_handler.h')
-rw-r--r-- | chrome/browser/external_protocol/external_protocol_handler.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/chrome/browser/external_protocol/external_protocol_handler.h b/chrome/browser/external_protocol/external_protocol_handler.h index 002b0c8..780861c 100644 --- a/chrome/browser/external_protocol/external_protocol_handler.h +++ b/chrome/browser/external_protocol/external_protocol_handler.h @@ -8,6 +8,8 @@ #include <string> +#include "chrome/browser/shell_integration.h" + class GURL; class PrefService; @@ -23,6 +25,22 @@ class ExternalProtocolHandler { UNKNOWN, }; + // Delegate to allow unit testing to provide different behavior. + class Delegate { + public: + virtual ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker( + ShellIntegration::DefaultWebClientObserver* observer, + const std::string& protocol) = 0; + virtual BlockState GetBlockState(const std::string& scheme) = 0; + virtual void BlockRequest() = 0; + virtual void RunExternalProtocolDialog(const GURL& url, + int render_process_host_id, + int routing_id) = 0; + virtual void LaunchUrlWithoutSecurityCheck(const GURL& url) = 0; + virtual void FinishedProcessingCheck() = 0; + virtual ~Delegate() {} + }; + // Returns whether we should block a given scheme. static BlockState GetBlockState(const std::string& scheme); @@ -37,7 +55,14 @@ class ExternalProtocolHandler { // application is launched. // Must run on the UI thread. static void LaunchUrl(const GURL& url, int render_process_host_id, - int tab_contents_id); + int tab_contents_id) { + LaunchUrlWithDelegate(url, render_process_host_id, tab_contents_id, NULL); + } + + // Version of LaunchUrl allowing use of a delegate to facilitate unit + // testing. + static void LaunchUrlWithDelegate(const GURL& url, int render_process_host_id, + int tab_contents_id, Delegate* delegate); // Creates and runs a External Protocol dialog box. // |url| - The url of the request. |