From 93b792798207296c98e08336e252288da9b7320f Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Tue, 7 Jun 2011 23:00:01 +0000 Subject: Download requests initiated in a ChromeFrame popup window opened via window.open should be reissued in the current navigation context. We use the attach external tab URL prefix as a cue to identify whether the navigation should be reissued in a new window. Fixes bug http://code.google.com/p/chromium/issues/detail?id=84235 BUG=84235 Review URL: http://codereview.chromium.org/7033061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88230 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/chrome_frame_activex_base.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'chrome_frame/chrome_frame_activex_base.h') diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h index 9667da0..e57a157 100644 --- a/chrome_frame/chrome_frame_activex_base.h +++ b/chrome_frame/chrome_frame_activex_base.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include // for IBrowserService2 #include @@ -448,6 +449,18 @@ END_MSG_MAP() // There's room for improvement here and also see todo below. LPARAM OnDownloadRequestInHost(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { + ChromeFrameUrl cf_url; + cf_url.Parse(UTF8ToWide(GetDocumentUrl())); + + // Always issue the download request in a new window to ensure that the + // currently loaded ChromeFrame document does not inadvartently see an + // unload request. This runs javascript unload handlers on the page which + // renders the page non functional. + VARIANT flags = { VT_I4 }; + V_I4(&flags) = navNoHistory; + if (!cf_url.attach_to_external_tab()) + V_I4(&flags) |= navOpenInNewWindow; + DownloadInHostParams* download_params = reinterpret_cast(wparam); DCHECK(download_params); @@ -459,7 +472,8 @@ END_MSG_MAP() NavigateBrowserToMoniker( doc_site_, download_params->moniker, UTF8ToWide(download_params->request_headers).c_str(), - download_params->bind_ctx, NULL, download_params->post_data); + download_params->bind_ctx, NULL, download_params->post_data, + &flags); } delete download_params; return TRUE; @@ -1051,7 +1065,6 @@ END_MSG_MAP() return; } } - // Last chance to handle the keystroke is to pass it to chromium. // We do this last partially because there's no way for us to tell if // chromium actually handled the keystroke, but also since the browser -- cgit v1.1