diff options
23 files changed, 212 insertions, 43 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 234e352..1d7de596 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -544,10 +544,13 @@ RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() { return this; } -void ExtensionHost::CreateNewWindow(int route_id) { +void ExtensionHost::CreateNewWindow( + int route_id, + WindowContainerType window_container_type) { delegate_view_helper_.CreateNewWindow( route_id, render_view_host()->process()->profile(), - site_instance(), DOMUIFactory::GetDOMUIType(url_), NULL); + site_instance(), DOMUIFactory::GetDOMUIType(url_), NULL, + window_container_type); } void ExtensionHost::CreateNewWidget(int route_id, diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index da3cdd0..39d2f8b 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -142,7 +142,9 @@ class ExtensionHost : public RenderViewHostDelegate, virtual RendererPreferences GetRendererPrefs(Profile* profile) const; // RenderViewHostDelegate::View - virtual void CreateNewWindow(int route_id); + virtual void CreateNewWindow( + int route_id, + WindowContainerType window_container_type); 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 d1786d9..9499f4f 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -86,10 +86,13 @@ void BalloonHost::ProcessDOMUIMessage(const std::string& message, // RenderViewHostDelegate::View methods implemented to allow links to // open pages in new tabs. -void BalloonHost::CreateNewWindow(int route_id) { +void BalloonHost::CreateNewWindow( + int route_id, + WindowContainerType window_container_type) { delegate_view_helper_.CreateNewWindow( route_id, balloon_->profile(), site_instance_.get(), - DOMUIFactory::GetDOMUIType(balloon_->notification().content_url()), NULL); + DOMUIFactory::GetDOMUIType(balloon_->notification().content_url()), NULL, + window_container_type); } void BalloonHost::ShowCreatedWindow(int route_id, diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h index 4c4aad8..4aabe39 100644 --- a/chrome/browser/notifications/balloon_host.h +++ b/chrome/browser/notifications/balloon_host.h @@ -78,7 +78,9 @@ class BalloonHost : public RenderViewHostDelegate, // RenderViewHostDelegate::View methods. Only the ones for opening new // windows are currently implemented. - virtual void CreateNewWindow(int route_id); + virtual void CreateNewWindow( + int route_id, + WindowContainerType window_container_type); 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 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, diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index 14eb26b..d22aead 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -86,7 +86,9 @@ class InterstitialPage::InterstitialPageRVHViewDelegate explicit InterstitialPageRVHViewDelegate(InterstitialPage* page); // RenderViewHostDelegate::View implementation: - virtual void CreateNewWindow(int route_id); + virtual void CreateNewWindow( + int route_id, + WindowContainerType window_container_type); virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); virtual void ShowCreatedWindow(int route_id, @@ -557,7 +559,8 @@ InterstitialPage::InterstitialPageRVHViewDelegate:: } void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWindow( - int route_id) { + int route_id, + WindowContainerType window_container_type) { 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 e8591fd..5fe2208 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -26,7 +26,8 @@ TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( Profile* profile, SiteInstance* site, DOMUITypeID domui_type, - TabContents* old_tab_contents) { + TabContents* old_tab_contents, + WindowContainerType window_container_type) { // 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 = 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 42052b9..351e036 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/waitable_event.h" #include "chrome/browser/dom_ui/dom_ui_factory.h" +#include "chrome/common/window_container_type.h" #include "gfx/rect.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" #include "webkit/glue/webpreferences.h" @@ -31,11 +32,13 @@ class RenderViewHostDelegateViewHelper { public: RenderViewHostDelegateViewHelper() {} - virtual TabContents* 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, + WindowContainerType window_container_type); virtual RenderWidgetHostView* CreateNewWidget(int route_id, WebKit::WebPopupType popup_type, RenderProcessHost* process); diff --git a/chrome/browser/tab_contents/tab_contents_view.cc b/chrome/browser/tab_contents/tab_contents_view.cc index bce9a50..b6d45a0 100644 --- a/chrome/browser/tab_contents/tab_contents_view.cc +++ b/chrome/browser/tab_contents/tab_contents_view.cc @@ -30,10 +30,13 @@ void TabContentsView::UpdatePreferredSize(const gfx::Size& pref_size) { preferred_width_ = pref_size.width(); } -void TabContentsView::CreateNewWindow(int route_id) { - TabContents* new_contents = delegate_view_helper_.CreateNewWindow( +void TabContentsView::CreateNewWindow( + int route_id, + WindowContainerType window_container_type) { + TabContents* new_contents = delegate_view_helper_.CreateNewWindow( route_id, tab_contents_->profile(), tab_contents_->GetSiteInstance(), - DOMUIFactory::GetDOMUIType(tab_contents_->GetURL()), tab_contents_); + DOMUIFactory::GetDOMUIType(tab_contents_->GetURL()), tab_contents_, + window_container_type); if (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 48c1558..e9e26b3 100644 --- a/chrome/browser/tab_contents/tab_contents_view.h +++ b/chrome/browser/tab_contents/tab_contents_view.h @@ -179,7 +179,9 @@ class TabContentsView : public RenderViewHostDelegate::View { // We implement these functions on RenderViewHostDelegate::View directly and // do some book-keeping associated with the request. The request is then // forwarded to *Internal which does platform-specific work. - virtual void CreateNewWindow(int route_id); + virtual void CreateNewWindow( + int route_id, + WindowContainerType window_container_type); virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); virtual void ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index d169a5a..668af2d 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -262,6 +262,8 @@ 'common/webkit_param_traits.h', 'common/webmessageportchannel_impl.cc', 'common/webmessageportchannel_impl.h', + 'common/window_container_type.cc', + 'common/window_container_type.h', 'common/worker_messages.h', 'common/worker_messages_internal.h', 'common/worker_thread_ticker.cc', diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index db6dfe5..359fa30 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -30,6 +30,7 @@ #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" #include "chrome/common/webkit_param_traits.h" +#include "chrome/common/window_container_type.h" #include "gfx/native_widget_types.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_utils.h" @@ -2608,7 +2609,7 @@ struct ParamTraits<ExtensionExtent> { GURL origin; std::vector<std::string> paths; bool success = - ReadParam(m, iter, &origin) && + ReadParam(m, iter, &origin) && ReadParam(m, iter, &paths); if (!success) return false; @@ -2637,6 +2638,27 @@ struct ParamTraits<ViewMsg_ExtensionExtentsUpdated_Params> { } }; +template <> +struct ParamTraits<WindowContainerType> { + typedef WindowContainerType param_type; + static void Write(Message* m, const param_type& p) { + int val = static_cast<int>(p); + WriteParam(m, val); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int val = 0; + if (!ReadParam(m, iter, &val) || + val < WINDOW_CONTAINER_TYPE_NORMAL || + val >= WINDOW_CONTAINER_TYPE_MAX_VALUE) + return false; + *p = static_cast<param_type>(val); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + LogParam(p, l); + } +}; + } // namespace IPC diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 314c933..60c4cab 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -24,6 +24,7 @@ #include "chrome/common/notification_type.h" #include "chrome/common/page_zoom.h" #include "chrome/common/translate_errors.h" +#include "chrome/common/window_container_type.h" #include "gfx/rect.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message.h" @@ -952,12 +953,14 @@ IPC_BEGIN_MESSAGES(ViewHost) // Sent by the renderer when it is creating a new window. The browser creates // a tab for it and responds with a ViewMsg_CreatingNew_ACK. If route_id is // MSG_ROUTING_NONE, the view couldn't be created. - IPC_SYNC_MESSAGE_CONTROL3_2(ViewHostMsg_CreateWindow, - int /* opener_id */, - bool /* user_gesture */, - int64 /* session_storage_namespace_id */, - int /* route_id */, - int64 /* cloned_session_storage_namespace_id */) + IPC_SYNC_MESSAGE_CONTROL4_2( + ViewHostMsg_CreateWindow, + int /* opener_id */, + bool /* user_gesture */, + WindowContainerType /* window_container_type */, + int64 /* session_storage_namespace_id */, + int /* route_id */, + int64 /* cloned_session_storage_namespace_id */) // Similar to ViewHostMsg_CreateWindow, except used for sub-widgets, like // <select> dropdowns. This message is sent to the TabContents that diff --git a/chrome/common/window_container_type.cc b/chrome/common/window_container_type.cc new file mode 100644 index 0000000..b33618e --- /dev/null +++ b/chrome/common/window_container_type.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/window_container_type.h" + +#include "base/string_util.h" +#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/WebKit/chromium/public/WebWindowFeatures.h" + +namespace { + +const char kBackground[] = "background"; +const char kPersistent[] = "persistent"; + +} + +WindowContainerType WindowFeaturesToContainerType( + const WebKit::WebWindowFeatures& window_features) { + bool background = false; + bool persistent = false; + + for (size_t i = 0; i < window_features.additionalFeatures.size(); ++i) { + if (LowerCaseEqualsASCII(window_features.additionalFeatures[i], + kBackground)) + background = true; + else if (LowerCaseEqualsASCII(window_features.additionalFeatures[i], + kPersistent)) + persistent = true; + } + + if (background) { + if (persistent) + return WINDOW_CONTAINER_TYPE_PERSISTENT; + else + return WINDOW_CONTAINER_TYPE_BACKGROUND; + } else { + return WINDOW_CONTAINER_TYPE_NORMAL; + } +} diff --git a/chrome/common/window_container_type.h b/chrome/common/window_container_type.h new file mode 100644 index 0000000..303d1cc --- /dev/null +++ b/chrome/common/window_container_type.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_WINDOW_CONTAINER_TYPE_H_ +#define CHROME_COMMON_WINDOW_CONTAINER_TYPE_H_ + +namespace WebKit { + +struct WebWindowFeatures; + +} + +// "Container" types which can be requested via the window.open feature +// string. +enum WindowContainerType { + // A window shown in popup or tab. + WINDOW_CONTAINER_TYPE_NORMAL = 0, + + // A window run as a hidden "background" page. + WINDOW_CONTAINER_TYPE_BACKGROUND, + + // A window run as a hidden "background" page that wishes to be started + // upon browser launch and run beyond the lifetime of the pages that + // reference it. + WINDOW_CONTAINER_TYPE_PERSISTENT, + + WINDOW_CONTAINER_TYPE_MAX_VALUE +}; + +// Conversion function: +WindowContainerType WindowFeaturesToContainerType( + const WebKit::WebWindowFeatures& window_features); + +#endif // CHROME_COMMON_WINDOW_CONTAINER_TYPE_H_ diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 4b3408a..abf23be 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -34,6 +34,7 @@ #include "chrome/common/renderer_preferences.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/url_constants.h" +#include "chrome/common/window_container_type.h" #include "chrome/renderer/about_handler.h" #include "chrome/renderer/audio_message_filter.h" #include "chrome/renderer/devtools_agent.h" @@ -105,6 +106,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/WebKit/chromium/public/WebWindowFeatures.h" #include "webkit/appcache/web_application_cache_host_impl.h" #include "webkit/default_plugin/default_plugin_shared.h" #include "webkit/glue/dom_operations.h" @@ -203,6 +205,7 @@ using WebKit::WebView; using WebKit::WebWidget; using WebKit::WebWorker; using WebKit::WebWorkerClient; +using WebKit::WebWindowFeatures; //----------------------------------------------------------------------------- @@ -1538,7 +1541,15 @@ void RenderView::OnMissingPluginStatus( // WebKit::WebViewClient ------------------------------------------------------ +// TODO(rafaelw): remove when +// WebViewClient::createView(WebFrame,WebWindowFeatures) lands. WebView* RenderView::createView(WebFrame* creator) { + return createView(creator, WebWindowFeatures()); +} + +WebView* RenderView::createView( + WebFrame* creator, + const WebWindowFeatures& features) { // Check to make sure we aren't overloading on popups. if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) return NULL; @@ -1553,10 +1564,13 @@ WebView* RenderView::createView(WebFrame* creator) { int64 cloned_session_storage_namespace_id; render_thread_->Send( - new ViewHostMsg_CreateWindow(routing_id_, user_gesture, - session_storage_namespace_id_, - &routing_id, - &cloned_session_storage_namespace_id)); + new ViewHostMsg_CreateWindow( + routing_id_, + user_gesture, + WindowFeaturesToContainerType(features), + session_storage_namespace_id_, + &routing_id, + &cloned_session_storage_namespace_id)); if (routing_id == MSG_ROUTING_NONE) return NULL; diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index e04a404..1eda03e 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -111,6 +111,7 @@ class WebURLRequest; struct WebFileChooserParams; struct WebFindOptions; struct WebPoint; +struct WebWindowFeatures; } // We need to prevent a page from trying to create infinite popups. It is not @@ -202,7 +203,12 @@ class RenderView : public RenderWidget, virtual void DnsPrefetch(const std::vector<std::string>& host_names); // WebKit::WebViewClient + // TODO(rafaelw): Remove this when + // WebViewClient::createView(WebFrame,WebWindowFeatures&) lands. virtual WebKit::WebView* createView(WebKit::WebFrame* creator); + virtual WebKit::WebView* createView( + WebKit::WebFrame* creator, + const WebKit::WebWindowFeatures& features); virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type); virtual WebKit::WebWidget* createPopupMenu( const WebKit::WebPopupMenuInfo& info); |