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

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

Issue 131783012: Fix the handling of user gestures for external protocol handler dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build Created 6 years, 9 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 7c934c5f7c6db51fe133bc4f5e2ad581836dd512..eb0057cbe76e87cde30c772a2ac6b38d4aba9a03 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.h
+++ b/chrome/browser/external_protocol/external_protocol_handler.h
@@ -55,7 +55,8 @@ class ExternalProtocolHandler {
// 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);
+ LaunchUrlWithDelegate(
+ url, render_process_host_id, tab_contents_id, NULL);
not at google - send to devlin 2014/03/28 18:54:23 doesn't seem like a necessary change, but "git cl
meacer 2014/03/28 19:53:11 Yes, this remained from the previous patchset.
}
// Version of LaunchUrl allowing use of a delegate to facilitate unit
@@ -96,11 +97,23 @@ 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();
+ class ScopedUserGesture {
+ public:
+ ScopedUserGesture() {
+ ExternalProtocolHandler::EnableUserGesture();
+ }
+ ~ScopedUserGesture() {
+ ExternalProtocolHandler::DisableUserGesture();
not at google - send to devlin 2014/03/28 18:54:23 that's not quite right, it would break nested scop
meacer 2014/03/28 19:53:11 Done.
+ }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedUserGesture);
+ };
+
+ private:
+ static void EnableUserGesture();
+ static void DisableUserGesture();
+ DISALLOW_COPY_AND_ASSIGN(ExternalProtocolHandler);
};
+
#endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698