diff options
author | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-12 02:47:26 +0000 |
---|---|---|
committer | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-12 02:47:26 +0000 |
commit | 8ab0465a0a52812b600580540a69ba4687e4ef22 (patch) | |
tree | 12c5483360d5174a2906e84234f4d3db72d8471d /chrome/browser | |
parent | 69a83853994057c9bb81fbc8e184cf36650293db (diff) | |
download | chromium_src-8ab0465a0a52812b600580540a69ba4687e4ef22.zip chromium_src-8ab0465a0a52812b600580540a69ba4687e4ef22.tar.gz chromium_src-8ab0465a0a52812b600580540a69ba4687e4ef22.tar.bz2 |
Added plumbing to transport the frame name between RenderViewHost and the Webkit layer.
Extended ViewMsg_New and ViewHostMsg_CreateWindow to have a new frame_name
parameter. This allows the RVH to know the initial name of the frame associated
with its RenderView, and also to set the name of the frame when creating a new
RenderView.
Review URL: http://codereview.chromium.org/2775003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49622 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
23 files changed, 84 insertions, 50 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 1a98b0d..e52f41b 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -202,7 +202,8 @@ void ExtensionHost::CreateRenderViewSoon(RenderWidgetHostView* host_view) { } void ExtensionHost::CreateRenderViewNow() { - render_view_host_->CreateRenderView(profile_->GetRequestContext()); + render_view_host_->CreateRenderView(profile_->GetRequestContext(), + string16()); NavigateToURL(url_); DCHECK(IsRenderViewLive()); } @@ -555,14 +556,16 @@ RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() { void ExtensionHost::CreateNewWindow( int route_id, - WindowContainerType window_container_type) { + WindowContainerType window_container_type, + const string16& frame_name) { delegate_view_helper_.CreateNewWindow( route_id, render_view_host()->process()->profile(), site_instance(), DOMUIFactory::GetDOMUIType(url_), this, - window_container_type); + window_container_type, + frame_name); } void ExtensionHost::CreateNewWidget(int route_id, diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index 8329164..4eb81d9c 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -146,7 +146,8 @@ class ExtensionHost : public RenderViewHostDelegate, // RenderViewHostDelegate::View virtual void CreateNewWindow( int route_id, - WindowContainerType window_container_type); + WindowContainerType window_container_type, + const string16& frame_name); virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); virtual void ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index c07593e..1c8fc17 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -88,14 +88,16 @@ void BalloonHost::ProcessDOMUIMessage(const std::string& message, // open pages in new tabs. void BalloonHost::CreateNewWindow( int route_id, - WindowContainerType window_container_type) { + WindowContainerType window_container_type, + const string16& frame_name) { delegate_view_helper_.CreateNewWindow( route_id, balloon_->profile(), site_instance_.get(), DOMUIFactory::GetDOMUIType(balloon_->notification().content_url()), this, - window_container_type); + window_container_type, + frame_name); } void BalloonHost::ShowCreatedWindow(int route_id, @@ -149,7 +151,7 @@ void BalloonHost::Init() { DCHECK(render_widget_host_view()); rvh->set_view(render_widget_host_view()); - rvh->CreateRenderView(GetProfile()->GetRequestContext()); + rvh->CreateRenderView(GetProfile()->GetRequestContext(), string16()); rvh->NavigateToURL(balloon_->notification().content_url()); initialized_ = true; diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h index 06c780e..07ddf3d 100644 --- a/chrome/browser/notifications/balloon_host.h +++ b/chrome/browser/notifications/balloon_host.h @@ -83,7 +83,8 @@ class BalloonHost : public RenderViewHostDelegate, // windows are currently implemented. virtual void CreateNewWindow( int route_id, - WindowContainerType window_container_type); + WindowContainerType window_container_type, + const string16& frame_name); virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type) {} virtual void ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index b14d9d5..a5414b6 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -146,7 +146,7 @@ RenderViewHost::~RenderViewHost() { } bool RenderViewHost::CreateRenderView( - URLRequestContextGetter* request_context) { + URLRequestContextGetter* request_context, const string16& frame_name) { DCHECK(!IsRenderViewLive()) << "Creating view twice"; // The process may (if we're sharing a process with another host that already @@ -191,6 +191,7 @@ bool RenderViewHost::CreateRenderView( params.web_preferences = webkit_prefs; params.view_id = routing_id(); params.session_storage_namespace_id = session_storage_namespace_id_; + params.frame_name = frame_name; Send(new ViewMsg_New(params)); // Set the alternate error page, which is profile specific, in the renderer. @@ -863,12 +864,13 @@ void RenderViewHost::Shutdown() { void RenderViewHost::CreateNewWindow( int route_id, - WindowContainerType window_container_type) { + WindowContainerType window_container_type, + const string16& frame_name) { RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); if (!view) return; - view->CreateNewWindow(route_id, window_container_type); + view->CreateNewWindow(route_id, window_container_type, frame_name); } void RenderViewHost::CreateNewWidget(int route_id, diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 53793e0..8619094 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -103,8 +103,10 @@ class RenderViewHost : public RenderWidgetHost { RenderViewHostDelegate* delegate() const { return delegate_; } // Set up the RenderView child process. Virtual because it is overridden by - // TestRenderViewHost. - virtual bool CreateRenderView(URLRequestContextGetter* request_context); + // TestRenderViewHost. If the |frame_name| parameter is non-empty, it is used + // as the name of the new top-level frame. + virtual bool CreateRenderView(URLRequestContextGetter* request_context, + const string16& frame_name); // Returns true if the RenderView is active and has not crashed. Virtual // because it is overridden by TestRenderViewHost. @@ -417,7 +419,8 @@ class RenderViewHost : public RenderWidgetHost { // Creates a new RenderView with the given route id. void CreateNewWindow(int route_id, - WindowContainerType window_container_type); + WindowContainerType window_container_type, + const string16& frame_name); // Creates a new RenderWidget with the given route id. |popup_type| indicates // if this widget is a popup and what kind of popup it is (select, autofill). diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h index 80ae7be..e2bd3864 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -93,13 +93,17 @@ class RenderViewHostDelegate { // that is requested -- in particular, the window.open call may have // specified 'background' and 'persistent' in the feature string. // + // The passed |frame_name| parameter is the name parameter that was passed + // to window.open(), and will be empty if none was passed. + // // Note: this is not called "CreateWindow" because that will clash with // the Windows function which is actually a #define. // // NOTE: this takes ownership of @modal_dialog_event virtual void CreateNewWindow( int route_id, - WindowContainerType window_container_type) = 0; + WindowContainerType window_container_type, + const string16& frame_name) = 0; // The page is trying to open a new widget (e.g. a select popup). The // widget should be created associated with the given route, but it should diff --git a/chrome/browser/renderer_host/render_widget_helper.cc b/chrome/browser/renderer_host/render_widget_helper.cc index 2c3b6f4..baa8045 100644 --- a/chrome/browser/renderer_host/render_widget_helper.cc +++ b/chrome/browser/renderer_host/render_widget_helper.cc @@ -203,6 +203,7 @@ void RenderWidgetHelper::CreateNewWindow( int opener_id, bool user_gesture, WindowContainerType window_container_type, + const string16& frame_name, base::ProcessHandle render_process, int* route_id) { *route_id = GetNextRoutingID(); @@ -215,16 +216,17 @@ void RenderWidgetHelper::CreateNewWindow( ChromeThread::UI, FROM_HERE, NewRunnableMethod( this, &RenderWidgetHelper::OnCreateWindowOnUI, opener_id, *route_id, - window_container_type)); + window_container_type, frame_name)); } void RenderWidgetHelper::OnCreateWindowOnUI( int opener_id, int route_id, - WindowContainerType window_container_type) { + WindowContainerType window_container_type, + string16 frame_name) { RenderViewHost* host = RenderViewHost::FromID(render_process_id_, opener_id); if (host) - host->CreateNewWindow(route_id, window_container_type); + host->CreateNewWindow(route_id, window_container_type, frame_name); ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, diff --git a/chrome/browser/renderer_host/render_widget_helper.h b/chrome/browser/renderer_host/render_widget_helper.h index f942903..d31bf66 100644 --- a/chrome/browser/renderer_host/render_widget_helper.h +++ b/chrome/browser/renderer_host/render_widget_helper.h @@ -123,6 +123,7 @@ class RenderWidgetHelper void CreateNewWindow(int opener_id, bool user_gesture, WindowContainerType window_container_type, + const string16& frame_name, base::ProcessHandle render_process, int* route_id); void CreateNewWidget(int opener_id, @@ -164,7 +165,8 @@ class RenderWidgetHelper // Called on the UI thread to finish creating a window. void OnCreateWindowOnUI(int opener_id, int route_id, - WindowContainerType window_container_type); + WindowContainerType window_container_type, + string16 frame_name); // Called on the IO thread after a window was created on the UI thread. void OnCreateWindowOnIO(int route_id); diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 61ac3d1..a382042 100755 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -640,15 +640,14 @@ URLRequestContext* ResourceMessageFilter::GetRequestContext( } void ResourceMessageFilter::OnMsgCreateWindow( - int opener_id, bool user_gesture, - WindowContainerType window_container_type, - int64 session_storage_namespace_id, int* route_id, - int64* cloned_session_storage_namespace_id) { + const ViewHostMsg_CreateWindow_Params& params, + int* route_id, int64* cloned_session_storage_namespace_id) { *cloned_session_storage_namespace_id = dom_storage_dispatcher_host_-> - CloneSessionStorage(session_storage_namespace_id); - render_widget_helper_->CreateNewWindow(opener_id, - user_gesture, - window_container_type, + CloneSessionStorage(params.session_storage_namespace_id); + render_widget_helper_->CreateNewWindow(params.opener_id, + params.user_gesture, + params.window_container_type, + params.frame_name, handle(), route_id); } diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 33a6d44..e79934a 100755 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -46,6 +46,7 @@ class NotificationsPrefsCache; class Profile; class RenderWidgetHelper; class URLRequestContextGetter; +struct ViewHostMsg_CreateWindow_Params; struct ViewHostMsg_CreateWorker_Params; struct WebPluginInfo; @@ -132,9 +133,8 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, virtual ~ResourceMessageFilter(); - void OnMsgCreateWindow(int opener_id, bool user_gesture, - WindowContainerType window_container_type, - int64 session_storage_namespace_id, int* route_id, + void OnMsgCreateWindow(const ViewHostMsg_CreateWindow_Params& params, + int* route_id, int64* cloned_session_storage_namespace_id); void OnMsgCreateWidget(int opener_id, WebKit::WebPopupType popup_type, diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc index 33c7529..c1d15599 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.cc +++ b/chrome/browser/renderer_host/test/test_render_view_host.cc @@ -32,7 +32,7 @@ TestRenderViewHost::~TestRenderViewHost() { } bool TestRenderViewHost::CreateRenderView( - URLRequestContextGetter* request_context) { + URLRequestContextGetter* request_context, const string16& frame_name) { DCHECK(!render_view_created_); render_view_created_ = true; process()->ViewCreated(); diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h index c50ba06..bda5712 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.h +++ b/chrome/browser/renderer_host/test/test_render_view_host.h @@ -165,7 +165,8 @@ class TestRenderViewHost : public RenderViewHost { // RenderViewHost overrides -------------------------------------------------- - virtual bool CreateRenderView(URLRequestContextGetter* request_context); + virtual bool CreateRenderView(URLRequestContextGetter* request_context, + const string16& frame_name); virtual bool IsRenderViewLive() const; private: diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index 33822a7..5409d65 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -156,13 +156,15 @@ void BackgroundContents::ProcessDOMUIMessage(const std::string& message, void BackgroundContents::CreateNewWindow( int route_id, - WindowContainerType window_container_type) { + WindowContainerType window_container_type, + const string16& frame_name) { delegate_view_helper_.CreateNewWindow(route_id, render_view_host_->process()->profile(), render_view_host_->site_instance(), DOMUIFactory::GetDOMUIType(url_), this, - window_container_type); + window_container_type, + frame_name); } void BackgroundContents::CreateNewWidget(int route_id, diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h index e2542ad..af07a19 100644 --- a/chrome/browser/tab_contents/background_contents.h +++ b/chrome/browser/tab_contents/background_contents.h @@ -67,7 +67,8 @@ class BackgroundContents : public RenderViewHostDelegate, // RenderViewHostDelegate::View virtual void CreateNewWindow( int route_id, - WindowContainerType window_container_type); + WindowContainerType window_container_type, + const string16& frame_name); virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); virtual void ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index d22aead..9c32297 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -88,7 +88,8 @@ class InterstitialPage::InterstitialPageRVHViewDelegate // RenderViewHostDelegate::View implementation: virtual void CreateNewWindow( int route_id, - WindowContainerType window_container_type); + WindowContainerType window_container_type, + const string16& frame_name); virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); virtual void ShowCreatedWindow(int route_id, @@ -407,7 +408,7 @@ TabContentsView* InterstitialPage::CreateTabContentsView() { if (!request_context.get()) request_context = tab()->profile()->GetRequestContext(); - render_view_host_->CreateRenderView(request_context.get()); + render_view_host_->CreateRenderView(request_context.get(), string16()); view->SetSize(tab_contents_view->GetContainerSize()); // Don't show the interstitial until we have navigated to it. view->Hide(); @@ -560,7 +561,8 @@ InterstitialPage::InterstitialPageRVHViewDelegate:: void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWindow( int route_id, - WindowContainerType window_container_type) { + WindowContainerType window_container_type, + const string16& frame_name) { NOTREACHED() << "InterstitialPage does not support showing popups yet."; } 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 2d80f2aa..be662e2 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -56,7 +56,8 @@ TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( SiteInstance* site, DOMUITypeID domui_type, RenderViewHostDelegate* opener, - WindowContainerType window_container_type) { + WindowContainerType window_container_type, + const string16& frame_name) { if (ShouldOpenBackgroundContents(window_container_type, opener->GetURL(), site->GetProcess(), 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 084762d..08ef2db 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h @@ -44,7 +44,8 @@ class RenderViewHostDelegateViewHelper { SiteInstance* site, DOMUITypeID domui_type, RenderViewHostDelegate* opener, - WindowContainerType window_container_type); + WindowContainerType window_container_type, + const string16& frame_name); // Creates a new RenderWidgetHost and saves it for later retrieval by // GetCreatedWidget. diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 0c8a6c8..8fc2d32 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -2911,7 +2911,7 @@ bool TabContents::CreateRenderViewForRenderManager( if (!request_context.get()) request_context = profile()->GetRequestContext(); - if (!render_view_host->CreateRenderView(request_context)) + if (!render_view_host->CreateRenderView(request_context, string16())) return false; // Now that the RenderView has been created, we need to tell it its size. diff --git a/chrome/browser/tab_contents/tab_contents_view.cc b/chrome/browser/tab_contents/tab_contents_view.cc index 0fb400e..00eaed76 100644 --- a/chrome/browser/tab_contents/tab_contents_view.cc +++ b/chrome/browser/tab_contents/tab_contents_view.cc @@ -28,11 +28,16 @@ void TabContentsView::RenderViewCreated(RenderViewHost* host) { void TabContentsView::CreateNewWindow( int route_id, - WindowContainerType window_container_type) { + WindowContainerType window_container_type, + const string16& frame_name) { TabContents* new_contents = delegate_view_helper_.CreateNewWindow( - route_id, tab_contents_->profile(), tab_contents_->GetSiteInstance(), - DOMUIFactory::GetDOMUIType(tab_contents_->GetURL()), tab_contents_, - window_container_type); + route_id, + tab_contents_->profile(), + tab_contents_->GetSiteInstance(), + DOMUIFactory::GetDOMUIType(tab_contents_->GetURL()), + tab_contents_, + window_container_type, + frame_name); if (new_contents && tab_contents_->delegate()) tab_contents_->delegate()->TabContentsCreated(new_contents); diff --git a/chrome/browser/tab_contents/tab_contents_view.h b/chrome/browser/tab_contents/tab_contents_view.h index e54e19d..36ee76a 100644 --- a/chrome/browser/tab_contents/tab_contents_view.h +++ b/chrome/browser/tab_contents/tab_contents_view.h @@ -178,7 +178,8 @@ class TabContentsView : public RenderViewHostDelegate::View { // forwarded to *Internal which does platform-specific work. virtual void CreateNewWindow( int route_id, - WindowContainerType window_container_type); + WindowContainerType window_container_type, + const string16& frame_name); virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); virtual void ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, diff --git a/chrome/browser/tab_contents/test_tab_contents.cc b/chrome/browser/tab_contents/test_tab_contents.cc index 84bde21..f0c7405 100644 --- a/chrome/browser/tab_contents/test_tab_contents.cc +++ b/chrome/browser/tab_contents/test_tab_contents.cc @@ -49,7 +49,8 @@ TestRenderViewHost* TestTabContents::pending_rvh() { bool TestTabContents::CreateRenderViewForRenderManager( RenderViewHost* render_view_host) { // This will go to a TestRenderViewHost. - render_view_host->CreateRenderView(profile()->GetRequestContext()); + render_view_host->CreateRenderView(profile()->GetRequestContext(), + string16()); return true; } diff --git a/chrome/browser/visitedlink_unittest.cc b/chrome/browser/visitedlink_unittest.cc index 3d79355..64d30bb 100644 --- a/chrome/browser/visitedlink_unittest.cc +++ b/chrome/browser/visitedlink_unittest.cc @@ -676,7 +676,7 @@ TEST_F(VisitedLinkEventsTest, Coalescense) { TEST_F(VisitedLinkRelayTest, Basics) { VisitedLinkMaster* master = profile_->GetVisitedLinkMaster(); - rvh()->CreateRenderView(profile_->GetRequestContext()); + rvh()->CreateRenderView(profile_->GetRequestContext(), string16()); // Add a few URLs. master->AddURL(GURL("http://acidtests.org/")); @@ -700,7 +700,7 @@ TEST_F(VisitedLinkRelayTest, Basics) { TEST_F(VisitedLinkRelayTest, TabVisibility) { VisitedLinkMaster* master = profile_->GetVisitedLinkMaster(); - rvh()->CreateRenderView(profile_->GetRequestContext()); + rvh()->CreateRenderView(profile_->GetRequestContext(), string16()); // Simulate tab becoming inactive. rvh()->WasHidden(); @@ -763,7 +763,7 @@ TEST_F(VisitedLinkRelayTest, WebViewReadiness) { EXPECT_EQ(0, profile()->add_event_count()); EXPECT_EQ(0, profile()->reset_event_count()); - rvh()->CreateRenderView(profile_->GetRequestContext()); + rvh()->CreateRenderView(profile_->GetRequestContext(), string16()); // We should now have just a reset event: adds are eaten up by a reset // that followed. |