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

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

Issue 426713002: Revert of Fix the handling of user gestures for external protocol handler dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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
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 6780d105a73eec0c9381c86de924658a4bf97dec..934ce31313337a015b6455beaf869dedfbe284b6 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.h
+++ b/chrome/browser/external_protocol/external_protocol_handler.h
@@ -30,8 +30,7 @@ class ExternalProtocolHandler {
virtual ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker(
ShellIntegration::DefaultWebClientObserver* observer,
const std::string& protocol) = 0;
- virtual BlockState GetBlockState(const std::string& scheme,
- bool initiated_by_user_gesture) = 0;
+ virtual BlockState GetBlockState(const std::string& scheme) = 0;
virtual void BlockRequest() = 0;
virtual void RunExternalProtocolDialog(const GURL& url,
int render_process_host_id,
@@ -42,17 +41,30 @@ class ExternalProtocolHandler {
};
// Returns whether we should block a given scheme.
- static BlockState GetBlockState(const std::string& scheme,
- bool initiated_by_user_gesture);
+ static BlockState GetBlockState(const std::string& scheme);
// Sets whether we should block a given scheme.
static void SetBlockState(const std::string& scheme, BlockState state);
+ // Checks to see if the protocol is allowed, if it is whitelisted,
+ // the application associated with the protocol is launched on the io thread,
+ // if it is blacklisted, returns silently. Otherwise, an
+ // ExternalProtocolDialog is created asking the user. If the user accepts,
+ // LaunchUrlWithoutSecurityCheck is called on the io thread and the
+ // application is launched.
+ // Must run on the UI thread.
+ static void LaunchUrl(const GURL& url,
+ int render_process_host_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,
- bool initiated_by_user_gesture);
+ 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.
@@ -87,6 +99,12 @@ class ExternalProtocolHandler {
// preferences for them do not already exist.
static void PrepopulateDictionary(base::DictionaryValue* win_pref);
+ // Allows LaunchUrl to proceed with launching an external protocol handler.
+ // This is typically triggered by a user gesture, but is also called for
+ // each extension API function. Note that each call to LaunchUrl resets
+ // the state to false (not allowed).
+ static void PermitLaunchUrl();
+
private:
DISALLOW_COPY_AND_ASSIGN(ExternalProtocolHandler);
};

Powered by Google App Engine
This is Rietveld 408576698