summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-24 18:36:40 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-24 18:36:40 +0000
commit3e90411bca7552fd365d74713c3080257a6cd889 (patch)
treede5c87b7cfe91d9de9da2de3dc315d315eb448f9
parentd71fabc7d4dd5f6d508347b2818584edb5f6acd5 (diff)
downloadchromium_src-3e90411bca7552fd365d74713c3080257a6cd889.zip
chromium_src-3e90411bca7552fd365d74713c3080257a6cd889.tar.gz
chromium_src-3e90411bca7552fd365d74713c3080257a6cd889.tar.bz2
Don't use GetAsTabContents. Send notifications from TabContentsView instead.
BUG=none TEST=none Review URL: http://codereview.chromium.org/6330007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72354 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_host.cc7
-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/prerender/prerender_contents.cc3
-rw-r--r--chrome/browser/prerender/prerender_contents.h3
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc5
-rw-r--r--chrome/browser/renderer_host/render_view_host.h4
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h23
-rw-r--r--chrome/browser/renderer_host/render_widget_helper.cc16
-rw-r--r--chrome/browser/tab_contents/background_contents.cc7
-rw-r--r--chrome/browser/tab_contents/background_contents.h3
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc6
-rw-r--r--chrome/browser/tab_contents/tab_contents_view.cc20
-rw-r--r--chrome/browser/tab_contents/tab_contents_view.h3
15 files changed, 50 insertions, 64 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 09fe9e6..b854971 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -533,8 +533,7 @@ RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() {
void ExtensionHost::CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name) {
+ const ViewHostMsg_CreateWindow_Params& params) {
// TODO(aa): Use the browser's profile if the extension is split mode
// incognito.
TabContents* new_contents = delegate_view_helper_.CreateNewWindow(
@@ -544,8 +543,8 @@ void ExtensionHost::CreateNewWindow(
DOMUIFactory::GetDOMUIType(render_view_host()->process()->profile(),
url_),
this,
- window_container_type,
- frame_name);
+ params.window_container_type,
+ params.frame_name);
TabContents* associated_contents = associated_tab_contents();
if (associated_contents && associated_contents->delegate())
diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h
index 234e40e..51db000 100644
--- a/chrome/browser/extensions/extension_host.h
+++ b/chrome/browser/extensions/extension_host.h
@@ -139,8 +139,7 @@ class ExtensionHost : public RenderViewHostDelegate,
// RenderViewHostDelegate::View
virtual void CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name);
+ const ViewHostMsg_CreateWindow_Params& params);
virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
virtual void CreateNewFullscreenWidget(int route_id,
WebKit::WebPopupType popup_type);
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index db96e39..d65173d 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -17,6 +17,7 @@
#include "chrome/common/notification_source.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/render_messages.h"
+#include "chrome/common/render_messages_params.h"
#include "chrome/common/renderer_preferences.h"
#include "chrome/common/url_constants.h"
#include "webkit/glue/webpreferences.h"
@@ -139,8 +140,7 @@ void BalloonHost::ProcessDOMUIMessage(
// open pages in new tabs.
void BalloonHost::CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name) {
+ const ViewHostMsg_CreateWindow_Params& params) {
delegate_view_helper_.CreateNewWindow(
route_id,
balloon_->profile(),
@@ -148,8 +148,8 @@ void BalloonHost::CreateNewWindow(
DOMUIFactory::GetDOMUIType(balloon_->profile(),
balloon_->notification().content_url()),
this,
- window_container_type,
- frame_name);
+ params.window_container_type,
+ params.frame_name);
}
void BalloonHost::ShowCreatedWindow(int route_id,
diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h
index 8ab8206..99a6c0a 100644
--- a/chrome/browser/notifications/balloon_host.h
+++ b/chrome/browser/notifications/balloon_host.h
@@ -71,8 +71,7 @@ class BalloonHost : public RenderViewHostDelegate,
// windows are currently implemented.
virtual void CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name);
+ const ViewHostMsg_CreateWindow_Params& params);
virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type) {}
virtual void CreateNewFullscreenWidget(
int route_id, WebKit::WebPopupType popup_type) {}
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index d3bac70..5048124 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -197,8 +197,7 @@ void PrerenderContents::ProcessDOMUIMessage(
void PrerenderContents::CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name) {
+ const ViewHostMsg_CreateWindow_Params& params) {
// Since we don't want to permit child windows that would have a
// window.opener property, terminate prerendering.
prerender_manager_->RemoveEntry(this);
diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h
index f64697e..8bda7a4 100644
--- a/chrome/browser/prerender/prerender_contents.h
+++ b/chrome/browser/prerender/prerender_contents.h
@@ -80,8 +80,7 @@ class PrerenderContents : public RenderViewHostDelegate,
// RenderViewHostDelegate::View
virtual void CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name);
+ const ViewHostMsg_CreateWindow_Params& params);
virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
virtual void CreateNewFullscreenWidget(
int route_id, WebKit::WebPopupType popup_type);
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 7300427..5f12b62 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -871,13 +871,12 @@ bool RenderViewHost::IsRenderView() const {
void RenderViewHost::CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name) {
+ const ViewHostMsg_CreateWindow_Params& params) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
if (!view)
return;
- view->CreateNewWindow(route_id, window_container_type, frame_name);
+ view->CreateNewWindow(route_id, params);
}
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 1e5f962..e1b6a3a 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -40,6 +40,7 @@ struct ContextMenuParams;
struct MediaPlayerAction;
struct ThumbnailScore;
struct ViewHostMsg_AccessibilityNotification_Params;
+struct ViewHostMsg_CreateWindow_Params;
struct ViewHostMsg_DidPreviewDocument_Params;
struct ViewHostMsg_DidPrintPage_Params;
struct ViewHostMsg_DomMessage_Params;
@@ -449,8 +450,7 @@ class RenderViewHost : public RenderWidgetHost {
// Creates a new RenderView with the given route id.
void CreateNewWindow(int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name);
+ const ViewHostMsg_CreateWindow_Params& params);
// 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 554c7d1..7cab0be 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -46,6 +46,7 @@ class SSLClientAuthHandler;
class SSLAddCertHandler;
class TabContents;
struct ThumbnailScore;
+struct ViewHostMsg_CreateWindow_Params;
struct ViewHostMsg_DidPrintPage_Params;
struct ViewHostMsg_DomMessage_Params;
struct ViewHostMsg_FrameNavigate_Params;
@@ -101,15 +102,15 @@ class RenderViewHostDelegate : public IPC::Channel::Listener {
class View {
public:
- // 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.
+ // 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.
+ // |params.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.
//
- // The passed |frame_name| parameter is the name parameter that was passed
- // to window.open(), and will be empty if none was passed.
+ // The passed |params.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.
@@ -117,8 +118,7 @@ class RenderViewHostDelegate : public IPC::Channel::Listener {
// NOTE: this takes ownership of @modal_dialog_event
virtual void CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name) = 0;
+ const ViewHostMsg_CreateWindow_Params& params) = 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
@@ -487,7 +487,8 @@ class RenderViewHostDelegate : public IPC::Channel::Listener {
virtual const GURL& GetURL() const;
// Return this object cast to a TabContents, if it is one. If the object is
- // not a TabContents, returns NULL.
+ // not a TabContents, returns NULL. DEPRECATED: Be sure to include brettw and
+ // jam as reviewers before you use this method.
virtual TabContents* GetAsTabContents();
// Return this object cast to a BackgroundContents, if it is one. If the
diff --git a/chrome/browser/renderer_host/render_widget_helper.cc b/chrome/browser/renderer_host/render_widget_helper.cc
index 3176027..d94ae33 100644
--- a/chrome/browser/renderer_host/render_widget_helper.cc
+++ b/chrome/browser/renderer_host/render_widget_helper.cc
@@ -9,9 +9,7 @@
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
-#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
-#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages_params.h"
// A Task used with InvokeLater that we hold a pointer to in pending_paints_.
@@ -222,18 +220,8 @@ void RenderWidgetHelper::OnCreateWindowOnUI(
int route_id) {
RenderViewHost* host =
RenderViewHost::FromID(render_process_id_, params.opener_id);
- if (host) {
- host->CreateNewWindow(route_id,
- params.window_container_type,
- params.frame_name);
- TabContents* tab_contents = host->delegate()->GetAsTabContents();
- if (tab_contents) {
- NotificationService::current()->Notify(
- NotificationType::CREATING_NEW_WINDOW,
- Source<TabContents>(tab_contents),
- Details<const ViewHostMsg_CreateWindow_Params>(&params));
- }
- }
+ if (host)
+ host->CreateNewWindow(route_id, params);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc
index b4eed25..52a15dd 100644
--- a/chrome/browser/tab_contents/background_contents.cc
+++ b/chrome/browser/tab_contents/background_contents.cc
@@ -209,16 +209,15 @@ void BackgroundContents::ProcessDOMUIMessage(
void BackgroundContents::CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name) {
+ const ViewHostMsg_CreateWindow_Params& params) {
delegate_view_helper_.CreateNewWindow(
route_id,
render_view_host_->process()->profile(),
render_view_host_->site_instance(),
DOMUIFactory::GetDOMUIType(render_view_host_->process()->profile(), url_),
this,
- window_container_type,
- frame_name);
+ params.window_container_type,
+ params.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 3ced642..1fe66af 100644
--- a/chrome/browser/tab_contents/background_contents.h
+++ b/chrome/browser/tab_contents/background_contents.h
@@ -82,8 +82,7 @@ class BackgroundContents : public RenderViewHostDelegate,
// RenderViewHostDelegate::View
virtual void CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name);
+ const ViewHostMsg_CreateWindow_Params& params);
virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
virtual void CreateNewFullscreenWidget(
int route_id, WebKit::WebPopupType popup_type);
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index c41c519..36f9004 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -92,8 +92,7 @@ class InterstitialPage::InterstitialPageRVHViewDelegate
// RenderViewHostDelegate::View implementation:
virtual void CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name);
+ const ViewHostMsg_CreateWindow_Params& params);
virtual void CreateNewWidget(int route_id,
WebKit::WebPopupType popup_type);
virtual void CreateNewFullscreenWidget(int route_id,
@@ -594,8 +593,7 @@ InterstitialPage::InterstitialPageRVHViewDelegate::
void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name) {
+ const ViewHostMsg_CreateWindow_Params& params) {
NOTREACHED() << "InterstitialPage does not support showing popups yet.";
}
diff --git a/chrome/browser/tab_contents/tab_contents_view.cc b/chrome/browser/tab_contents/tab_contents_view.cc
index 47e71f2..25264f0 100644
--- a/chrome/browser/tab_contents/tab_contents_view.cc
+++ b/chrome/browser/tab_contents/tab_contents_view.cc
@@ -11,6 +11,8 @@
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/render_messages_params.h"
TabContentsView::TabContentsView(TabContents* tab_contents)
: tab_contents_(tab_contents) {
@@ -30,8 +32,7 @@ void TabContentsView::RenderViewCreated(RenderViewHost* host) {
void TabContentsView::CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name) {
+ const ViewHostMsg_CreateWindow_Params& params) {
TabContents* new_contents = delegate_view_helper_.CreateNewWindow(
route_id,
tab_contents_->profile(),
@@ -39,11 +40,18 @@ void TabContentsView::CreateNewWindow(
DOMUIFactory::GetDOMUIType(tab_contents_->profile(),
tab_contents_->GetURL()),
tab_contents_,
- window_container_type,
- frame_name);
+ params.window_container_type,
+ params.frame_name);
- if (new_contents && tab_contents_->delegate())
- tab_contents_->delegate()->TabContentsCreated(new_contents);
+ if (new_contents) {
+ NotificationService::current()->Notify(
+ NotificationType::CREATING_NEW_WINDOW,
+ Source<TabContents>(tab_contents_),
+ Details<const ViewHostMsg_CreateWindow_Params>(&params));
+
+ if (tab_contents_->delegate())
+ tab_contents_->delegate()->TabContentsCreated(new_contents);
+ }
}
void TabContentsView::CreateNewWidget(int route_id,
diff --git a/chrome/browser/tab_contents/tab_contents_view.h b/chrome/browser/tab_contents/tab_contents_view.h
index 14ee0d5..e4b66a3 100644
--- a/chrome/browser/tab_contents/tab_contents_view.h
+++ b/chrome/browser/tab_contents/tab_contents_view.h
@@ -189,8 +189,7 @@ class TabContentsView : public RenderViewHostDelegate::View {
// forwarded to *Internal which does platform-specific work.
virtual void CreateNewWindow(
int route_id,
- WindowContainerType window_container_type,
- const string16& frame_name);
+ const ViewHostMsg_CreateWindow_Params& params);
virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
virtual void CreateNewFullscreenWidget(
int route_id, WebKit::WebPopupType popup_type);