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

Unified Diff: chrome/browser/external_protocol/external_protocol_handler.h

Issue 7790021: Open external application dialog should not show for Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits addressed Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/external_protocol/external_protocol_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {}
+ };
+
// 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.
« no previous file with comments | « no previous file | chrome/browser/external_protocol/external_protocol_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698