summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 16:18:02 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 16:18:02 +0000
commit014664d1a84c416cc67a91a9338ad08e3179050d (patch)
treeba3a4ef79d16ddf5cfcc53ff7ce4d08999c920c7 /chrome
parent6d702704ce32a2013a54cbc0a68e82bc5203aba5 (diff)
downloadchromium_src-014664d1a84c416cc67a91a9338ad08e3179050d.zip
chromium_src-014664d1a84c416cc67a91a9338ad08e3179050d.tar.gz
chromium_src-014664d1a84c416cc67a91a9338ad08e3179050d.tar.bz2
CreateNewWindowInternal and ShowCreatedWindowInternal aren't actually platform-dependent, so fold them into their only callers, CreateNewWindow and ShowCreatedWindow.
Review URL: http://codereview.chromium.org/42645 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12650 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/tab_contents/web_contents_view.cc32
-rw-r--r--chrome/browser/tab_contents/web_contents_view.h24
-rw-r--r--chrome/browser/tab_contents/web_contents_view_gtk.cc15
-rw-r--r--chrome/browser/tab_contents/web_contents_view_gtk.h6
-rw-r--r--chrome/browser/tab_contents/web_contents_view_mac.h6
-rw-r--r--chrome/browser/tab_contents/web_contents_view_mac.mm39
-rw-r--r--chrome/browser/tab_contents/web_contents_view_win.cc39
-rw-r--r--chrome/browser/tab_contents/web_contents_view_win.h6
8 files changed, 36 insertions, 131 deletions
diff --git a/chrome/browser/tab_contents/web_contents_view.cc b/chrome/browser/tab_contents/web_contents_view.cc
index 5ac141f..e472ef4 100644
--- a/chrome/browser/tab_contents/web_contents_view.cc
+++ b/chrome/browser/tab_contents/web_contents_view.cc
@@ -26,9 +26,25 @@ void WebContentsView::RenderWidgetHostDestroyed(RenderWidgetHost* host) {
void WebContentsView::CreateNewWindow(int route_id,
base::WaitableEvent* modal_dialog_event) {
+ // Create the new web contents. This will automatically create the new
+ // WebContentsView. In the future, we may want to create the view separately.
+ WebContents* new_contents =
+ new WebContents(web_contents()->profile(),
+ web_contents()->GetSiteInstance(),
+ web_contents()->render_view_factory_,
+ route_id,
+ modal_dialog_event);
+ new_contents->SetupController(web_contents()->profile());
+ WebContentsView* new_view = new_contents->view();
+
+ new_view->CreateView();
+
+ // TODO(brettw) it seems bogus that we have to call this function on the
+ // newly created object and give it one of its own member variables.
+ new_view->CreateViewForWidget(new_contents->render_view_host());
+
// Save the created window associated with the route so we can show it later.
- pending_contents_[route_id] = CreateNewWindowInternal(route_id,
- modal_dialog_event);
+ pending_contents_[route_id] = new_contents;
}
void WebContentsView::CreateNewWidget(int route_id, bool activatable) {
@@ -50,8 +66,16 @@ void WebContentsView::ShowCreatedWindow(int route_id,
WebContents* new_web_contents = iter->second;
pending_contents_.erase(route_id);
- ShowCreatedWindowInternal(new_web_contents, disposition, initial_pos,
- user_gesture);
+ if (!new_web_contents->render_widget_host_view() ||
+ !new_web_contents->process()->channel()) {
+ // The view has gone away or the renderer crashed. Nothing to do.
+ return;
+ }
+
+ // TODO(brettw) this seems bogus to reach into here and initialize the host.
+ new_web_contents->render_view_host()->Init();
+ web_contents()->AddNewContents(new_web_contents, disposition, initial_pos,
+ user_gesture);
}
void WebContentsView::ShowCreatedWidget(int route_id,
diff --git a/chrome/browser/tab_contents/web_contents_view.h b/chrome/browser/tab_contents/web_contents_view.h
index d4bce3e..a63c84c 100644
--- a/chrome/browser/tab_contents/web_contents_view.h
+++ b/chrome/browser/tab_contents/web_contents_view.h
@@ -123,23 +123,15 @@ class WebContentsView : public RenderViewHostDelegate::View {
protected:
WebContentsView() {} // Abstract interface.
- // Internal interface for some functions in the RenderViewHostDelegate::View
- // interface. Subclasses should implement this rather than the corresponding
- // ...::View functions directly, since the routing stuff will already be
- // computed. They should implement the rest of the functions as normal.
+ // Internal functions used to support the CreateNewWidget() method. If a
+ // platform requires plugging into widget creation at a lower level then a
+ // subclass might want to override these functions, but otherwise they should
+ // be fine just implementing RenderWidgetHostView::InitAsPopup().
//
- // The only difference is that the Create functions return the newly
- // created objects so that they can be associated with the given routes. When
- // they are shown later, we'll look them up again and pass the objects to
- // the Show functions rather than the route ID.
- virtual WebContents* CreateNewWindowInternal(
- int route_id,
- base::WaitableEvent* modal_dialog_event) = 0;
- virtual void ShowCreatedWindowInternal(WebContents* new_web_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture) = 0;
-
+ // The Create function returns the newly created widget so it can be
+ // associated with the given route. When the widget needs to be shown later,
+ // we'll look it up again and pass the object to the Show functions rather
+ // than the route ID.
virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id,
bool activatable);
virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view,
diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.cc b/chrome/browser/tab_contents/web_contents_view_gtk.cc
index 3c58613..a858fea 100644
--- a/chrome/browser/tab_contents/web_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/web_contents_view_gtk.cc
@@ -231,18 +231,3 @@ void WebContentsViewGtk::StartDragging(const WebDropData& drop_data) {
if (web_contents()->render_view_host())
web_contents()->render_view_host()->DragSourceSystemDragEnded();
}
-
-WebContents* WebContentsViewGtk::CreateNewWindowInternal(
- int route_id,
- base::WaitableEvent* modal_dialog_event) {
- NOTIMPLEMENTED();
- return NULL;
-}
-
-void WebContentsViewGtk::ShowCreatedWindowInternal(
- WebContents* new_web_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture) {
- NOTIMPLEMENTED();
-}
diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.h b/chrome/browser/tab_contents/web_contents_view_gtk.h
index 82f4cae..f755af6 100644
--- a/chrome/browser/tab_contents/web_contents_view_gtk.h
+++ b/chrome/browser/tab_contents/web_contents_view_gtk.h
@@ -44,12 +44,6 @@ class WebContentsViewGtk : public WebContentsView {
virtual void RestoreFocus();
// Backend implementation of RenderViewHostDelegate::View.
- virtual WebContents* CreateNewWindowInternal(
- int route_id, base::WaitableEvent* modal_dialog_event);
- virtual void ShowCreatedWindowInternal(WebContents* new_web_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture);
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void StartDragging(const WebDropData& drop_data);
virtual void UpdateDragCursor(bool is_drop_target);
diff --git a/chrome/browser/tab_contents/web_contents_view_mac.h b/chrome/browser/tab_contents/web_contents_view_mac.h
index 4257274..f85bc98 100644
--- a/chrome/browser/tab_contents/web_contents_view_mac.h
+++ b/chrome/browser/tab_contents/web_contents_view_mac.h
@@ -59,12 +59,6 @@ class WebContentsViewMac : public WebContentsView,
virtual void RestoreFocus();
// Backend implementation of RenderViewHostDelegate::View.
- virtual WebContents* CreateNewWindowInternal(
- int route_id, base::WaitableEvent* modal_dialog_event);
- virtual void ShowCreatedWindowInternal(WebContents* new_web_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture);
virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id,
bool activatable);
virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view,
diff --git a/chrome/browser/tab_contents/web_contents_view_mac.mm b/chrome/browser/tab_contents/web_contents_view_mac.mm
index c466a68..d36e10b 100644
--- a/chrome/browser/tab_contents/web_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/web_contents_view_mac.mm
@@ -185,45 +185,6 @@ void WebContentsViewMac::ShowContextMenu(const ContextMenuParams& params) {
GetNativeView());
}
-WebContents* WebContentsViewMac::CreateNewWindowInternal(
- int route_id,
- base::WaitableEvent* modal_dialog_event) {
- // Create the new web contents. This will automatically create the new
- // WebContentsView. In the future, we may want to create the view separately.
- WebContents* new_contents =
- new WebContents(web_contents()->profile(),
- web_contents()->GetSiteInstance(),
- web_contents()->render_view_factory_,
- route_id,
- modal_dialog_event);
- new_contents->SetupController(web_contents()->profile());
- WebContentsView* new_view = new_contents->view();
-
- new_view->CreateView();
-
- // TODO(brettw) it seems bogus that we have to call this function on the
- // newly created object and give it one of its own member variables.
- new_view->CreateViewForWidget(new_contents->render_view_host());
- return new_contents;
-}
-
-void WebContentsViewMac::ShowCreatedWindowInternal(
- WebContents* new_web_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture) {
- if (!new_web_contents->render_widget_host_view() ||
- !new_web_contents->process()->channel()) {
- // The view has gone away or the renderer crashed. Nothing to do.
- return;
- }
-
- // TODO(brettw) this seems bogus to reach into here and initialize the host.
- new_web_contents->render_view_host()->Init();
- web_contents()->AddNewContents(new_web_contents, disposition, initial_pos,
- user_gesture);
-}
-
RenderWidgetHostView* WebContentsViewMac::CreateNewWidgetInternal(
int route_id,
bool activatable) {
diff --git a/chrome/browser/tab_contents/web_contents_view_win.cc b/chrome/browser/tab_contents/web_contents_view_win.cc
index ca148a2..2a159c7 100644
--- a/chrome/browser/tab_contents/web_contents_view_win.cc
+++ b/chrome/browser/tab_contents/web_contents_view_win.cc
@@ -366,45 +366,6 @@ void WebContentsViewWin::ShowContextMenu(const ContextMenuParams& params) {
MessageLoop::current()->SetNestableTasksAllowed(old_state);
}
-WebContents* WebContentsViewWin::CreateNewWindowInternal(
- int route_id,
- base::WaitableEvent* modal_dialog_event) {
- // Create the new web contents. This will automatically create the new
- // WebContentsView. In the future, we may want to create the view separately.
- WebContents* new_contents =
- new WebContents(web_contents()->profile(),
- web_contents()->GetSiteInstance(),
- web_contents()->render_view_factory_,
- route_id,
- modal_dialog_event);
- new_contents->SetupController(web_contents()->profile());
- WebContentsView* new_view = new_contents->view();
-
- new_view->CreateView();
-
- // TODO(brettw) it seems bogus that we have to call this function on the
- // newly created object and give it one of its own member variables.
- new_view->CreateViewForWidget(new_contents->render_view_host());
- return new_contents;
-}
-
-void WebContentsViewWin::ShowCreatedWindowInternal(
- WebContents* new_web_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture) {
- if (!new_web_contents->render_widget_host_view() ||
- !new_web_contents->process()->channel()) {
- // The view has gone away or the renderer crashed. Nothing to do.
- return;
- }
-
- // TODO(brettw) this seems bogus to reach into here and initialize the host.
- new_web_contents->render_view_host()->Init();
- web_contents()->AddNewContents(new_web_contents, disposition, initial_pos,
- user_gesture);
-}
-
void WebContentsViewWin::OnHScroll(int scroll_type, short position,
HWND scrollbar) {
ScrollCommon(WM_HSCROLL, scroll_type, position, scrollbar);
diff --git a/chrome/browser/tab_contents/web_contents_view_win.h b/chrome/browser/tab_contents/web_contents_view_win.h
index 7f3eeed..6eeb77e 100644
--- a/chrome/browser/tab_contents/web_contents_view_win.h
+++ b/chrome/browser/tab_contents/web_contents_view_win.h
@@ -44,12 +44,6 @@ class WebContentsViewWin : public WebContentsView,
virtual void RestoreFocus();
// Backend implementation of RenderViewHostDelegate::View.
- virtual WebContents* CreateNewWindowInternal(
- int route_id, base::WaitableEvent* modal_dialog_event);
- virtual void ShowCreatedWindowInternal(WebContents* new_web_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture);
virtual void ShowContextMenu(const ContextMenuParams& params);
virtual void StartDragging(const WebDropData& drop_data);
virtual void UpdateDragCursor(bool is_drop_target);