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 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_ |