diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 22:53:11 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 22:53:11 +0000 |
commit | 534c66c7338db94220b0f5995b299415d99e918e (patch) | |
tree | af5c53e617901fa64ddd0478f133e091724c7d8f /chrome/browser/renderer_host | |
parent | 121de344c56a98dcb82612b7f789d70eb646b592 (diff) | |
download | chromium_src-534c66c7338db94220b0f5995b299415d99e918e.zip chromium_src-534c66c7338db94220b0f5995b299415d99e918e.tar.gz chromium_src-534c66c7338db94220b0f5995b299415d99e918e.tar.bz2 |
This is the second side of a multi-sided webkit patch that will allow experimental window.open feature strings to be captured and passed to the client.
It should wait for: https://bugs.webkit.org/show_bug.cgi?id=38013 to land. This is required because this patch needs to use the WebWindowFeature binding struct in WebKit.
Once this is landed, a webkit patch to change the call signature for WebViewClient::createView to include the WebWindowFeatures will be submitted (and after that another chromium patch to remove the old call signature).
This patch implements old and new WebViewClient::createView signatures, and additionally passes the vector all the way to RenderViewHostDelegateHelper who will eventually use it to observe the 'background' feature.
BUG=41275
TEST=all tests should pass
Review URL: http://codereview.chromium.org/1758004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
7 files changed, 38 insertions, 14 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 1cd72fe..0cca1a9 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -848,12 +848,14 @@ void RenderViewHost::Shutdown() { RenderWidgetHost::Shutdown(); } -void RenderViewHost::CreateNewWindow(int route_id) { +void RenderViewHost::CreateNewWindow( + int route_id, + WindowContainerType window_container_type) { RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); if (!view) return; - view->CreateNewWindow(route_id); + view->CreateNewWindow(route_id, window_container_type); } 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 61f8208..b384d6d 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -15,6 +15,7 @@ #include "chrome/common/page_zoom.h" #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" +#include "chrome/common/window_container_type.h" #include "net/base/load_states.h" #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" @@ -418,7 +419,8 @@ class RenderViewHost : public RenderWidgetHost { virtual gfx::Rect GetRootWindowResizerRect() const; // Creates a new RenderView with the given route id. - void CreateNewWindow(int route_id); + void CreateNewWindow(int route_id, + WindowContainerType window_container_type); // 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 40a7745..233099c 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -13,6 +13,7 @@ #include "chrome/common/content_settings_types.h" #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" +#include "chrome/common/window_container_type.h" #include "net/base/load_states.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" @@ -88,12 +89,17 @@ class RenderViewHostDelegate { // The page is trying to open a new page (e.g. a popup window). The // window should be created associated with the given route, but it should // not be shown yet. That should happen in response to ShowCreatedWindow. + // |window_container_type| describes the type of RenderViewHost container + // that is requested -- in particular, the window.open call may have + // specified 'background' and 'persistent' in the feature string. // // 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) = 0; + virtual void CreateNewWindow( + int route_id, + WindowContainerType window_container_type) = 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 5c379e7..2c3b6f4 100644 --- a/chrome/browser/renderer_host/render_widget_helper.cc +++ b/chrome/browser/renderer_host/render_widget_helper.cc @@ -199,10 +199,12 @@ void RenderWidgetHelper::OnCrossSiteClosePageACK( resource_dispatcher_host_->OnClosePageACK(params); } -void RenderWidgetHelper::CreateNewWindow(int opener_id, - bool user_gesture, - base::ProcessHandle render_process, - int* route_id) { +void RenderWidgetHelper::CreateNewWindow( + int opener_id, + bool user_gesture, + WindowContainerType window_container_type, + base::ProcessHandle render_process, + int* route_id) { *route_id = GetNextRoutingID(); // Block resource requests until the view is created, since the HWND might be // needed if a response ends up creating a plugin. @@ -212,13 +214,17 @@ void RenderWidgetHelper::CreateNewWindow(int opener_id, ChromeThread::PostTask( ChromeThread::UI, FROM_HERE, NewRunnableMethod( - this, &RenderWidgetHelper::OnCreateWindowOnUI, opener_id, *route_id)); + this, &RenderWidgetHelper::OnCreateWindowOnUI, opener_id, *route_id, + window_container_type)); } -void RenderWidgetHelper::OnCreateWindowOnUI(int opener_id, int route_id) { +void RenderWidgetHelper::OnCreateWindowOnUI( + int opener_id, + int route_id, + WindowContainerType window_container_type) { RenderViewHost* host = RenderViewHost::FromID(render_process_id_, opener_id); if (host) - host->CreateNewWindow(route_id); + host->CreateNewWindow(route_id, window_container_type); 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 33ca744..f942903 100644 --- a/chrome/browser/renderer_host/render_widget_helper.h +++ b/chrome/browser/renderer_host/render_widget_helper.h @@ -14,6 +14,7 @@ #include "base/ref_counted.h" #include "base/lock.h" #include "base/waitable_event.h" +#include "chrome/common/window_container_type.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" namespace IPC { @@ -121,6 +122,7 @@ class RenderWidgetHelper void CreateNewWindow(int opener_id, bool user_gesture, + WindowContainerType window_container_type, base::ProcessHandle render_process, int* route_id); void CreateNewWidget(int opener_id, @@ -161,7 +163,8 @@ class RenderWidgetHelper // Called on the UI thread to finish creating a window. void OnCreateWindowOnUI(int opener_id, - int route_id); + int route_id, + WindowContainerType window_container_type); // 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 7ef3f8e..0ef86ea 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -598,12 +598,15 @@ URLRequestContext* ResourceMessageFilter::GetRequestContext( } void ResourceMessageFilter::OnMsgCreateWindow( - int opener_id, bool user_gesture, int64 session_storage_namespace_id, - int* route_id, int64* cloned_session_storage_namespace_id) { + int opener_id, bool user_gesture, + WindowContainerType window_container_type, + int64 session_storage_namespace_id, 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, handle(), route_id); } diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 5013257..e16edc8 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -27,6 +27,7 @@ #include "chrome/common/nacl_types.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/render_messages.h" +#include "chrome/common/window_container_type.h" #include "gfx/native_widget_types.h" #include "gfx/rect.h" #include "ipc/ipc_channel_proxy.h" @@ -132,6 +133,7 @@ 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, int64* cloned_session_storage_namespace_id); void OnMsgCreateWidget(int opener_id, |