Commit f1cd3365 authored by jam@chromium.org's avatar jam@chromium.org

Remove call of PrerenderTracker::TryCancelOnIOThread in...

Remove call of PrerenderTracker::TryCancelOnIOThread in ChromeContentBrowserClient::CanCreateWindow. I moved cancelling the prerender on the UI thread.

BUG=304341
R=jochen@chromium.org, tburkard@chromium.org

Review URL: https://codereview.chromium.org/112573008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243375 0039d316-1c4b-4281-b951-d872f2087c98
parent e66b592f
......@@ -572,6 +572,13 @@ void HandleBlockedPopupOnUIThread(const BlockedWindowParams& params) {
if (!tab)
return;
prerender::PrerenderContents* prerender_contents =
prerender::PrerenderContents::FromWebContents(tab);
if (prerender_contents) {
prerender_contents->Destroy(prerender::FINAL_STATUS_CREATE_NEW_WINDOW);
return;
}
PopupBlockerTabHelper* popup_helper =
PopupBlockerTabHelper::FromWebContents(tab);
if (!popup_helper)
......@@ -2083,14 +2090,6 @@ bool ChromeContentBrowserClient::CanCreateWindow(
return false;
}
if (g_browser_process->prerender_tracker() &&
g_browser_process->prerender_tracker()->TryCancelOnIOThread(
render_process_id,
opener_id,
prerender::FINAL_STATUS_CREATE_NEW_WINDOW)) {
return false;
}
if (is_guest)
return true;
......
......@@ -92,6 +92,21 @@ class PrerenderContents::WebContentsDelegateImpl
callback.Run(false);
}
virtual bool ShouldCreateWebContents(
WebContents* web_contents,
int route_id,
WindowContainerType window_container_type,
const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,
SessionStorageNamespace* session_storage_namespace) OVERRIDE {
// Since we don't want to permit child windows that would have a
// window.opener property, terminate prerendering.
prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW);
// Cancel the popup.
return false;
}
virtual bool OnGoToEntryOffset(int offset) OVERRIDE {
// This isn't allowed because the history merge operation
// does not work if there are renderer issued challenges.
......
......@@ -1368,6 +1368,12 @@ void WebContentsImpl::CreateNewWindow(
params.target_url,
partition_id,
session_storage_namespace)) {
if (route_id != MSG_ROUTING_NONE &&
!RenderViewHost::FromID(render_process_id, route_id)) {
// If the embedder didn't create a WebContents for this route, we need to
// delete the RenderView that had already been created.
Send(new ViewMsg_Close(route_id));
}
GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id);
GetRenderViewHost()->GetProcess()->ResumeRequestsForView(
main_frame_route_id);
......
......@@ -294,6 +294,8 @@ class CONTENT_EXPORT WebContentsDelegate {
// Allows delegate to control whether a WebContents will be created. Returns
// true to allow the creation. Default is to allow it. In cases where the
// delegate handles the creation/navigation itself, it will use |target_url|.
// The embedder has to synchronously adopt |route_id| or else the view will
// be destroyed.
virtual bool ShouldCreateWebContents(
WebContents* web_contents,
int route_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment