From 7485bce7b0e770e9a9987088e9dc90acc760fe1f Mon Sep 17 00:00:00 2001 From: "dmaclach@chromium.org" Date: Wed, 11 May 2011 05:09:24 +0000 Subject: Revert 84922 - Block the creation of a new window when prerendering. Broke on vista tests (dbg4). BUG=none TEST=PrerenderBrowserTest.PrerenderPopup Review URL: http://codereview.chromium.org/6955003 TBR=dominich@chromium.org Review URL: http://codereview.chromium.org/6995043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84933 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/prerender/prerender_contents.cc | 5 ++--- chrome/browser/prerender/prerender_manager.cc | 2 +- .../tab_contents/render_view_host_delegate_helper.cc | 13 +------------ content/browser/tab_contents/tab_contents_view.cc | 5 ----- content/common/notification_type.h | 6 ------ 5 files changed, 4 insertions(+), 27 deletions(-) diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index bfbba25..4a989bc 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -285,8 +285,7 @@ void PrerenderContents::StartPrerendering( Source(GetRenderViewHostDelegate())); // Register for new windows from any source. - notification_registrar_.Add(this, - NotificationType::CREATING_NEW_WINDOW_CANCELLED, + notification_registrar_.Add(this, NotificationType::CREATING_NEW_WINDOW, Source(new_contents)); DCHECK(load_start_time_.is_null()); @@ -491,7 +490,7 @@ void PrerenderContents::Observe(NotificationType type, break; } - case NotificationType::CREATING_NEW_WINDOW_CANCELLED: { + case NotificationType::CREATING_NEW_WINDOW: { if (prerender_contents_.get()) { CHECK(Source(source).ptr() == prerender_contents_->tab_contents()); diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index 5425ecf..9aa02fd 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc @@ -551,6 +551,7 @@ bool PrerenderManager::MaybeUsePreloadedPage(TabContents* tab_contents, new_tab_contents->controller().CopyStateFromAndPrune( &old_tab_contents->controller(), false); + old_tab_contents->delegate()->SwapTabContents(old_tab_contents, new_tab_contents); MarkTabContentsAsPrerendered(tab_contents); @@ -822,7 +823,6 @@ void PrerenderManager::DeleteOldTabContents() { while (!old_tab_contents_list_.empty()) { TabContentsWrapper* tab_contents = old_tab_contents_list_.front(); old_tab_contents_list_.pop_front(); - // TODO(dominich): should we use Instant Unload Handler here? delete tab_contents; } MaybeStopSchedulingPeriodicCleanups(); diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index a4f8745..57c3ed8 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -15,7 +15,6 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" -#include "chrome/browser/prerender/prerender_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tab_contents/background_contents.h" #include "chrome/browser/user_style_sheet_watcher.h" @@ -105,23 +104,13 @@ TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( } } - TabContents* base_tab_contents = opener->GetAsTabContents(); - - // Do not create the new TabContents if the opener is a prerender TabContents. - prerender::PrerenderManager* prerender_manager = - profile->GetPrerenderManager(); - if (prerender_manager && - prerender_manager->IsTabContentsPrerendering(base_tab_contents)) { - return NULL; - } - // Create the new web contents. This will automatically create the new // TabContentsView. In the future, we may want to create the view separately. TabContents* new_contents = new TabContents(profile, site, route_id, - base_tab_contents, + opener->GetAsTabContents(), NULL); new_contents->set_opener_web_ui_type(webui_type); TabContentsView* new_view = new_contents->view(); diff --git a/content/browser/tab_contents/tab_contents_view.cc b/content/browser/tab_contents/tab_contents_view.cc index 4ea5d9b..79ee406 100644 --- a/content/browser/tab_contents/tab_contents_view.cc +++ b/content/browser/tab_contents/tab_contents_view.cc @@ -50,11 +50,6 @@ void TabContentsView::CreateNewWindow( if (tab_contents_->delegate()) tab_contents_->delegate()->TabContentsCreated(new_contents); - } else { - NotificationService::current()->Notify( - NotificationType::CREATING_NEW_WINDOW_CANCELLED, - Source(tab_contents_), - Details(¶ms)); } } diff --git a/content/common/notification_type.h b/content/common/notification_type.h index e19e01c..85a829b 100644 --- a/content/common/notification_type.h +++ b/content/common/notification_type.h @@ -131,12 +131,6 @@ class NotificationType { // ViewHostMsg_CreateWindow_Params object are provided. CREATING_NEW_WINDOW, - // A new window was requested but was not created. The source will be a - // Source corresponding to the tab the request originated from. - // Details are the ViewHostMsg_CreateWindow_Params object that were used in - // the request. - CREATING_NEW_WINDOW_CANCELLED, - // SSL --------------------------------------------------------------------- // Updating the SSL security indicators (the lock icon and such) proceeds -- cgit v1.1