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

Unified Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc

Issue 2179923002: Add a JavaScript dialog tab helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 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 | « chrome/browser/ui/tab_helpers.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
index a58e021b4ba8fe95482c2d568067581fc057d036..0b62a81733c3961b7283c27c77dfd388c526e03b 100644
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
@@ -213,8 +213,17 @@ bool MimeHandlerViewGuest::PreHandleGestureEvent(
content::JavaScriptDialogManager*
MimeHandlerViewGuest::GetJavaScriptDialogManager(
WebContents* source) {
+ // WebContentsDelegates often service multiple WebContentses, and use the
+ // WebContents* parameter to tell which WebContents made the request. If we
+ // pass in our own pointer to the delegate call, the delegate will be asked,
+ // "What's the JavaScriptDialogManager of this WebContents for which you are
+ // not a delegate?" And it won't be able to answer that.
+ //
+ // So we pretend to be our owner WebContents, but only for the request to
+ // obtain the JavaScriptDialogManager. During calls to the
+ // JavaScriptDialogManager we will be honest about who we are.
return owner_web_contents()->GetDelegate()->GetJavaScriptDialogManager(
- web_contents());
+ owner_web_contents());
}
bool MimeHandlerViewGuest::SaveFrame(const GURL& url,
« no previous file with comments | « chrome/browser/ui/tab_helpers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698