From 72a5e46303c13d806475cd01aedfb1305fcde5d7 Mon Sep 17 00:00:00 2001 From: mathiash Date: Wed, 19 Nov 2014 00:18:50 -0800 Subject: Add WebContents source to methods in WebContentsDelegate The added parameter helps us avoid a potential timing-related security issue. The UI can be instructed to open a new tab and show a dialog roughly at the same time, and since it's handled asynchronously the dialog may end up in front of the new tab. Knowing what web contents issued the dialog would allow us to prevent that from happening. BUG=428793 Review URL: https://codereview.chromium.org/691823002 Cr-Commit-Position: refs/heads/master@{#304781} --- content/public/browser/web_contents_delegate.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'content/public/browser/web_contents_delegate.h') diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index bcd5caf..92c8dcd 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -176,7 +176,7 @@ class CONTENT_EXPORT WebContentsDelegate { // Returns true if javascript dialogs and unload alerts are suppressed. // Default is false. - virtual bool ShouldSuppressDialogs(); + virtual bool ShouldSuppressDialogs(WebContents* source); // Returns whether pending NavigationEntries for aborted browser-initiated // navigations should be preserved (and thus returned from GetVisibleURL). @@ -342,7 +342,8 @@ class CONTENT_EXPORT WebContentsDelegate { // Returns a pointer to a service to manage JavaScript dialogs. May return // NULL in which case dialogs aren't shown. - virtual JavaScriptDialogManager* GetJavaScriptDialogManager(); + virtual JavaScriptDialogManager* GetJavaScriptDialogManager( + WebContents* source); // Called when color chooser should open. Returns the opened color chooser. // Returns NULL if we failed to open the color chooser (e.g. when there is a -- cgit v1.1