From 5951b5c1c74422be6793df444364f2f5436685ff Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Mon, 22 Feb 2010 18:15:34 +0000 Subject: Initial HTTP requests issued by ChromeFrame popups could bypass the host network stack. The host network stack in ChromeFrame intercepts HTTP requests based on registered render views. When a popup window is created we register it in the AddNewContents notification on the TabContentsDelegate. This is a little late as network requests could be issued before the view actually becomes visible. To fix this we now have a new method in the TabContentsDelegate interface called TabContentsCreated which notifies the delegate about the creation of a new TabContents. The ExternalTabContainer implements this method and registers the render view as pending. I also changed the signature of the RenderViewHostDelegateViewHelper::CreateNewWindow method to return the new TabContents. As part of this fix we also unregister the render view when the ExternalTabContainer is deleted. The container registers for the NotificationType::RENDER_VIEW_HOST_DELETED notification. However we end up deleting the TabContents in WM_DESTROY, which results in the container never receiving this notification. Fixes bug http://code.google.com/p/chromium/issues/detail?id=36323 Bug=36323 Test=Will be covered by the automation proxy test which Stoyan is adding Review URL: http://codereview.chromium.org/652009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39611 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/external_tab_container.cc | 33 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'chrome/browser/external_tab_container.cc') diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 0abba3b..55e8846 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -163,8 +163,12 @@ void ExternalTabContainer::Uninitialize() { registrar_.RemoveAll(); if (tab_contents_) { RenderViewHost* rvh = tab_contents_->render_view_host(); - if (rvh && DevToolsManager::GetInstance()) { - DevToolsManager::GetInstance()->UnregisterDevToolsClientHostFor(rvh); + if (rvh) { + if (DevToolsManager::GetInstance()) + DevToolsManager::GetInstance()->UnregisterDevToolsClientHostFor(rvh); + + AutomationResourceMessageFilter::UnRegisterRenderView( + rvh->process()->id(), rvh->routing_id()); } NotificationService::current()->Notify( @@ -351,17 +355,6 @@ void ExternalTabContainer::AddNewContents(TabContents* source, new_container->set_pending(true); - RenderViewHost* rvh = new_contents->render_view_host(); - DCHECK(rvh != NULL); - if (rvh) { - // Register this render view as a pending render view, i.e. any network - // requests initiated by this render view would be serviced when the - // external host connects to the new external tab instance. - AutomationResourceMessageFilter::RegisterRenderView( - rvh->process()->id(), rvh->routing_id(), - tab_handle_, automation_resource_message_filter_, - true); - } automation_->Send(new AutomationMsg_AttachExternalTab( 0, tab_handle_, @@ -372,6 +365,20 @@ void ExternalTabContainer::AddNewContents(TabContents* source, } } +void ExternalTabContainer::TabContentsCreated(TabContents* new_contents) { + RenderViewHost* rvh = new_contents->render_view_host(); + DCHECK(rvh != NULL); + if (rvh) { + // Register this render view as a pending render view, i.e. any network + // requests initiated by this render view would be serviced when the + // external host connects to the new external tab instance. + AutomationResourceMessageFilter::RegisterRenderView( + rvh->process()->id(), rvh->routing_id(), + tab_handle_, automation_resource_message_filter_, + true); + } +} + void ExternalTabContainer::ActivateContents(TabContents* contents) { } -- cgit v1.1