Chromium Code Reviews| Index: chrome/browser/external_protocol/external_protocol_handler.h |
| diff --git a/chrome/browser/external_protocol/external_protocol_handler.h b/chrome/browser/external_protocol/external_protocol_handler.h |
| index 002b0c8e8b4b8565c58196f5b0259395739e3e30..780861c273af53421f0cb2d24ccc248ceb303b7e 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() {} |
|
tony
2011/09/22 17:34:38
Does clang complain about this destructor? I thou
benwells
2011/09/23 00:29:51
try success on linux_clang and mac trybots, so it
|
| + }; |
| + |
| // 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. |