summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-22 18:15:34 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-22 18:15:34 +0000
commit5951b5c1c74422be6793df444364f2f5436685ff (patch)
treecb424f37692a95576cd314cb8bc9dc8e6b844c88 /chrome/browser/tab_contents
parent750d1df01bae3a105313008e649d6a8e756bc316 (diff)
downloadchromium_src-5951b5c1c74422be6793df444364f2f5436685ff.zip
chromium_src-5951b5c1c74422be6793df444364f2f5436685ff.tar.gz
chromium_src-5951b5c1c74422be6793df444364f2f5436685ff.tar.bz2
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
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc3
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.h10
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h4
-rw-r--r--chrome/browser/tab_contents/tab_contents_view.cc5
4 files changed, 15 insertions, 7 deletions
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 a69d1f1..084e571 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -20,7 +20,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-void RenderViewHostDelegateViewHelper::CreateNewWindow(
+TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow(
int route_id,
Profile* profile,
SiteInstance* site,
@@ -42,6 +42,7 @@ void RenderViewHostDelegateViewHelper::CreateNewWindow(
// Save the created window associated with the route so we can show it later.
pending_contents_[route_id] = new_contents;
+ return new_contents;
}
RenderWidgetHostView* RenderViewHostDelegateViewHelper::CreateNewWidget(
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.h b/chrome/browser/tab_contents/render_view_host_delegate_helper.h
index 21ce783..5078858 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h
@@ -30,11 +30,11 @@ class RenderViewHostDelegateViewHelper {
public:
RenderViewHostDelegateViewHelper() {}
- virtual void CreateNewWindow(int route_id,
- Profile* profile,
- SiteInstance* site,
- DOMUITypeID domui_type,
- TabContents* old_tab_contents);
+ virtual TabContents* CreateNewWindow(int route_id,
+ Profile* profile,
+ SiteInstance* site,
+ DOMUITypeID domui_type,
+ TabContents* old_tab_contents);
virtual RenderWidgetHostView* CreateNewWidget(int route_id, bool activatable,
RenderProcessHost* process);
virtual TabContents* GetCreatedWindow(int route_id);
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index e2b00b5..a6ddbd1 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -278,6 +278,10 @@ class TabContentsDelegate {
// Returns the native window framing the view containing the tab contents.
virtual gfx::NativeWindow GetFrameNativeWindow() { return NULL; }
+ // Notifies the delegate about the creation of a new TabContents. This
+ // typically happens when popups are created.
+ virtual void TabContentsCreated(TabContents* new_contents) {}
+
protected:
~TabContentsDelegate() {}
};
diff --git a/chrome/browser/tab_contents/tab_contents_view.cc b/chrome/browser/tab_contents/tab_contents_view.cc
index 4d25c33..fc5455e 100644
--- a/chrome/browser/tab_contents/tab_contents_view.cc
+++ b/chrome/browser/tab_contents/tab_contents_view.cc
@@ -31,9 +31,12 @@ void TabContentsView::UpdatePreferredSize(const gfx::Size& pref_size) {
}
void TabContentsView::CreateNewWindow(int route_id) {
- delegate_view_helper_.CreateNewWindow(
+ TabContents* new_contents = delegate_view_helper_.CreateNewWindow(
route_id, tab_contents_->profile(), tab_contents_->GetSiteInstance(),
DOMUIFactory::GetDOMUIType(tab_contents_->GetURL()), tab_contents_);
+
+ if (tab_contents_->delegate())
+ tab_contents_->delegate()->TabContentsCreated(new_contents);
}
void TabContentsView::CreateNewWidget(int route_id, bool activatable) {