summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extension_host.cc9
-rw-r--r--chrome/browser/extensions/extension_host.h3
-rw-r--r--chrome/browser/notifications/balloon_host.cc8
-rw-r--r--chrome/browser/notifications/balloon_host.h3
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc8
-rw-r--r--chrome/browser/renderer_host/render_view_host.h9
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h6
-rw-r--r--chrome/browser/renderer_host/render_widget_helper.cc8
-rw-r--r--chrome/browser/renderer_host/render_widget_helper.h4
-rwxr-xr-xchrome/browser/renderer_host/resource_message_filter.cc15
-rwxr-xr-xchrome/browser/renderer_host/resource_message_filter.h6
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.cc2
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.h3
-rw-r--r--chrome/browser/tab_contents/background_contents.cc6
-rw-r--r--chrome/browser/tab_contents/background_contents.h3
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc8
-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.h3
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc2
-rw-r--r--chrome/browser/tab_contents/tab_contents_view.cc13
-rw-r--r--chrome/browser/tab_contents/tab_contents_view.h3
-rw-r--r--chrome/browser/tab_contents/test_tab_contents.cc3
-rw-r--r--chrome/browser/visitedlink_unittest.cc6
-rw-r--r--chrome/common/render_messages.h60
-rwxr-xr-xchrome/common/render_messages_internal.h12
-rwxr-xr-xchrome/renderer/render_thread.cc12
-rwxr-xr-xchrome/renderer/render_view.cc46
-rw-r--r--chrome/renderer/render_view.h11
-rw-r--r--chrome/test/render_view_test.cc13
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc9
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h5
31 files changed, 219 insertions, 83 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.
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 6cddbc6..6a82112 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -639,6 +639,27 @@ struct ViewMsg_New_Params {
// The session storage namespace ID this view should use.
int64 session_storage_namespace_id;
+
+ // The name of the frame associated with this view (or empty if none).
+ string16 frame_name;
+};
+
+struct ViewHostMsg_CreateWindow_Params {
+ // Routing ID of the view initiating the open.
+ int opener_id;
+
+ // True if this open request came in the context of a user gesture.
+ bool user_gesture;
+
+ // Type of window requested.
+ WindowContainerType window_container_type;
+
+ // The session storage namespace ID this view should use.
+ int64 session_storage_namespace_id;
+
+ // The name of the resulting frame that should be created (empty if none
+ // has been specified).
+ string16 frame_name;
};
struct ViewHostMsg_RunFileChooser_Params {
@@ -2521,6 +2542,7 @@ struct ParamTraits<ViewMsg_New_Params> {
WriteParam(m, p.web_preferences);
WriteParam(m, p.view_id);
WriteParam(m, p.session_storage_namespace_id);
+ WriteParam(m, p.frame_name);
}
static bool Read(const Message* m, void** iter, param_type* p) {
@@ -2529,7 +2551,8 @@ struct ParamTraits<ViewMsg_New_Params> {
ReadParam(m, iter, &p->renderer_preferences) &&
ReadParam(m, iter, &p->web_preferences) &&
ReadParam(m, iter, &p->view_id) &&
- ReadParam(m, iter, &p->session_storage_namespace_id);
+ ReadParam(m, iter, &p->session_storage_namespace_id) &&
+ ReadParam(m, iter, &p->frame_name);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");
@@ -2542,6 +2565,8 @@ struct ParamTraits<ViewMsg_New_Params> {
LogParam(p.view_id, l);
l->append(L", ");
LogParam(p.session_storage_namespace_id, l);
+ l->append(L", ");
+ LogParam(p.frame_name, l);
l->append(L")");
}
};
@@ -2592,6 +2617,39 @@ struct ParamTraits<ViewHostMsg_RunFileChooser_Params> {
}
};
+template<>
+struct ParamTraits<ViewHostMsg_CreateWindow_Params> {
+ typedef ViewHostMsg_CreateWindow_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.opener_id);
+ WriteParam(m, p.user_gesture);
+ WriteParam(m, p.window_container_type);
+ WriteParam(m, p.session_storage_namespace_id);
+ WriteParam(m, p.frame_name);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->opener_id) &&
+ ReadParam(m, iter, &p->user_gesture) &&
+ ReadParam(m, iter, &p->window_container_type) &&
+ ReadParam(m, iter, &p->session_storage_namespace_id) &&
+ ReadParam(m, iter, &p->frame_name);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.opener_id, l);
+ l->append(L", ");
+ LogParam(p.user_gesture, l);
+ l->append(L", ");
+ LogParam(p.window_container_type, l);
+ l->append(L", ");
+ LogParam(p.session_storage_namespace_id, l);
+ l->append(L", ");
+ LogParam(p.frame_name, l);
+ l->append(L")");
+ }
+};
+
template <>
struct ParamTraits<ExtensionExtent> {
typedef ExtensionExtent param_type;
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 75edafa..39583a0 100755
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -978,14 +978,10 @@ 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_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 */)
+ IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_CreateWindow,
+ ViewHostMsg_CreateWindow_Params,
+ 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/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index f01167f..bd89be9 100755
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -623,9 +623,15 @@ void RenderThread::OnCreateNewView(const ViewMsg_New_Params& params) {
EnsureWebKitInitialized();
// When bringing in render_view, also bring in webkit's glue and jsbindings.
RenderView::Create(
- this, params.parent_window, MSG_ROUTING_NONE, params.renderer_preferences,
- params.web_preferences, new SharedRenderViewCounter(0), params.view_id,
- params.session_storage_namespace_id);
+ this,
+ params.parent_window,
+ MSG_ROUTING_NONE,
+ params.renderer_preferences,
+ params.web_preferences,
+ new SharedRenderViewCounter(0),
+ params.view_id,
+ params.session_storage_namespace_id,
+ params.frame_name);
}
void RenderThread::OnSetCacheCapacities(size_t min_dead_capacity,
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index f4c952c..ab01439 100755
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -498,7 +498,8 @@ RenderView* RenderView::Create(
const WebPreferences& webkit_prefs,
SharedRenderViewCounter* counter,
int32 routing_id,
- int64 session_storage_namespace_id) {
+ int64 session_storage_namespace_id,
+ const string16& frame_name) {
DCHECK(routing_id != MSG_ROUTING_NONE);
scoped_refptr<RenderView> view = new RenderView(render_thread, webkit_prefs,
session_storage_namespace_id);
@@ -506,7 +507,8 @@ RenderView* RenderView::Create(
opener_id,
renderer_prefs,
counter,
- routing_id); // adds reference
+ routing_id,
+ frame_name); // adds reference
return view;
}
@@ -541,7 +543,8 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd,
int32 opener_id,
const RendererPreferences& renderer_prefs,
SharedRenderViewCounter* counter,
- int32 routing_id) {
+ int32 routing_id,
+ const string16& frame_name) {
DCHECK(!webview());
if (opener_id != MSG_ROUTING_NONE)
@@ -562,6 +565,9 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd,
Singleton<ViewMap>::get()->insert(std::make_pair(webview(), this));
webkit_preferences_.Apply(webview());
webview()->initializeMainFrame(this);
+ // TODO(atwilson): Enable this when setName() becomes available upstream.
+ // if (!frame_name.empty)
+ // webview()->mainFrame()->setName(frame_name);
webview()->setDevToolsAgent(
WebDevToolsAgent::create(webview(), devtools_agent_.get()));
@@ -1587,9 +1593,18 @@ void RenderView::OnMissingPluginStatus(
// WebKit::WebViewClient ------------------------------------------------------
+// TODO(atwilson): Remove this older API when we've pushed the related changes
+// upstream.
WebView* RenderView::createView(
WebFrame* creator,
const WebWindowFeatures& features) {
+ return createView(creator, features, WebString());
+}
+
+WebView* RenderView::createView(
+ WebFrame* creator,
+ const WebWindowFeatures& features,
+ const WebString& frame_name) {
// Check to make sure we aren't overloading on popups.
if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups)
return NULL;
@@ -1598,19 +1613,21 @@ WebView* RenderView::createView(
// message from the Browser process explicitly allowing it.
script_can_close_ = false;
+ ViewHostMsg_CreateWindow_Params params;
+ params.opener_id = routing_id_;
+ params.user_gesture = creator->isProcessingUserGesture();
+ params.window_container_type = WindowFeaturesToContainerType(features);
+ params.session_storage_namespace_id = session_storage_namespace_id_;
+ params.frame_name = frame_name;
+
int32 routing_id = MSG_ROUTING_NONE;
- bool user_gesture = creator->isProcessingUserGesture();
- bool opener_suppressed = creator->willSuppressOpenerInNewFrame();
int64 cloned_session_storage_namespace_id;
+ bool opener_suppressed = creator->willSuppressOpenerInNewFrame();
render_thread_->Send(
- new ViewHostMsg_CreateWindow(
- routing_id_,
- user_gesture,
- WindowFeaturesToContainerType(features),
- session_storage_namespace_id_,
- &routing_id,
- &cloned_session_storage_namespace_id));
+ new ViewHostMsg_CreateWindow(params,
+ &routing_id,
+ &cloned_session_storage_namespace_id));
if (routing_id == MSG_ROUTING_NONE)
return NULL;
@@ -1621,8 +1638,9 @@ WebView* RenderView::createView(
webkit_preferences_,
shared_popup_counter_,
routing_id,
- cloned_session_storage_namespace_id);
- view->opened_by_user_gesture_ = user_gesture;
+ cloned_session_storage_namespace_id,
+ frame_name);
+ view->opened_by_user_gesture_ = params.user_gesture;
// Record whether the creator frame is trying to suppress the opener field.
view->opener_suppressed_ = opener_suppressed;
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 65122af..34457ac 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -155,7 +155,8 @@ class RenderView : public RenderWidget,
const WebPreferences& webkit_prefs,
SharedRenderViewCounter* counter,
int32 routing_id,
- int64 session_storage_namespace_id);
+ int64 session_storage_namespace_id,
+ const string16& frame_name);
// Visit all RenderViews with a live WebView (i.e., RenderViews that have
// been closed but not yet destroyed are excluded).
@@ -306,9 +307,14 @@ class RenderView : public RenderWidget,
// WebKit::WebViewClient implementation --------------------------------------
+ // TODO(atwilson): Remove this API when we push related changes upstream
virtual WebKit::WebView* createView(
WebKit::WebFrame* creator,
const WebKit::WebWindowFeatures& features);
+ virtual WebKit::WebView* createView(
+ WebKit::WebFrame* creator,
+ const WebKit::WebWindowFeatures& features,
+ const WebKit::WebString& frame_name);
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
virtual WebKit::WebWidget* createPopupMenu(
const WebKit::WebPopupMenuInfo& info);
@@ -616,7 +622,8 @@ class RenderView : public RenderWidget,
int32 opener_id,
const RendererPreferences& renderer_prefs,
SharedRenderViewCounter* counter,
- int32 routing_id);
+ int32 routing_id,
+ const string16& frame_name);
void UpdateURL(WebKit::WebFrame* frame);
void UpdateTitle(WebKit::WebFrame* frame, const string16& title);
diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc
index 07a5e05..7503230 100644
--- a/chrome/test/render_view_test.cc
+++ b/chrome/test/render_view_test.cc
@@ -105,10 +105,15 @@ void RenderViewTest::SetUp() {
render_thread_.set_routing_id(kRouteId);
// This needs to pass the mock render thread to the view.
- view_ = RenderView::Create(&render_thread_, 0, kOpenerId,
- RendererPreferences(), WebPreferences(),
- new SharedRenderViewCounter(0), kRouteId,
- kInvalidSessionStorageNamespaceId);
+ view_ = RenderView::Create(&render_thread_,
+ 0,
+ kOpenerId,
+ RendererPreferences(),
+ WebPreferences(),
+ new SharedRenderViewCounter(0),
+ kRouteId,
+ kInvalidSessionStorageNamespaceId,
+ string16());
// Attach a pseudo keyboard device to this object.
mock_keyboard_.reset(new MockKeyboard());
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 19dea28..9aa3c26 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -316,13 +316,20 @@ void TestWebViewDelegate::SetAuthorAndUserStylesEnabled(bool is_enabled) {
}
// WebViewClient -------------------------------------------------------------
-
+// TODO(atwilson): Remove this API when we push related changes upstream
WebView* TestWebViewDelegate::createView(
WebFrame* creator,
const WebWindowFeatures& window_features) {
return shell_->CreateWebView();
}
+WebView* TestWebViewDelegate::createView(
+ WebFrame* creator,
+ const WebWindowFeatures& window_features,
+ const WebString& frame_name) {
+ return shell_->CreateWebView();
+}
+
WebWidget* TestWebViewDelegate::createPopupMenu(WebPopupType popup_type) {
// TODO(darin): Should we take into account |popup_type| (for activation
// purpose)?
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 1d1c4eb..a96049a42 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -76,9 +76,14 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
typedef std::vector<CapturedContextMenuEvent> CapturedContextMenuEvents;
// WebKit::WebViewClient
+ // TODO(atwilson): Remove this API when we push related changes upstream
virtual WebKit::WebView* createView(
WebKit::WebFrame* creator,
const WebKit::WebWindowFeatures& window_features);
+ virtual WebKit::WebView* createView(
+ WebKit::WebFrame* creator,
+ const WebKit::WebWindowFeatures& features,
+ const WebKit::WebString& frame_name);
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
virtual WebKit::WebWidget* createPopupMenu(
const WebKit::WebPopupMenuInfo& info);