diff options
author | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-23 15:28:57 +0000 |
---|---|---|
committer | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-23 15:28:57 +0000 |
commit | f3332e18f25320eaa140d36405318d46a86ce443 (patch) | |
tree | 0d5fa00fc06aabdcbb426abe36d71862f859ea54 /chrome/browser/tab_contents | |
parent | 199535dd2ca0210a5c69d35e43f0432d8638f407 (diff) | |
download | chromium_src-f3332e18f25320eaa140d36405318d46a86ce443.zip chromium_src-f3332e18f25320eaa140d36405318d46a86ce443.tar.gz chromium_src-f3332e18f25320eaa140d36405318d46a86ce443.tar.bz2 |
Hook up popup windows on Mac (no blocking yet).
Review URL: http://codereview.chromium.org/52015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12284 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 8 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents_view_mac.mm | 34 |
2 files changed, 35 insertions, 7 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index d7dacb2..d24c1cd1 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -283,6 +283,7 @@ ConstrainedWindow* TabContents::CreateConstrainedDialog( child_windows_.push_back(window); return window; } +#endif void TabContents::AddNewContents(TabContents* new_contents, WindowOpenDisposition disposition, @@ -291,6 +292,7 @@ void TabContents::AddNewContents(TabContents* new_contents, if (!delegate_) return; +#if defined(OS_WIN) if ((disposition == NEW_POPUP) && !user_gesture) { // Unrequested popups from normal pages are constrained. TabContents* popup_owner = this; @@ -306,8 +308,14 @@ void TabContents::AddNewContents(TabContents* new_contents, PopupNotificationVisibilityChanged(ShowingBlockedPopupNotification()); } +#else + // TODO(port): implement the popup blocker stuff + delegate_->AddNewContents(this, new_contents, disposition, initial_pos, + user_gesture); +#endif } +#if defined(OS_WIN) void TabContents::AddConstrainedPopup(TabContents* new_contents, const gfx::Rect& initial_pos) { if (!blocked_popups_) { diff --git a/chrome/browser/tab_contents/web_contents_view_mac.mm b/chrome/browser/tab_contents/web_contents_view_mac.mm index 4c93ed7..c2fdfe1 100644 --- a/chrome/browser/tab_contents/web_contents_view_mac.mm +++ b/chrome/browser/tab_contents/web_contents_view_mac.mm @@ -189,10 +189,23 @@ void WebContentsViewMac::ShowContextMenu(const ContextMenuParams& params) { WebContents* WebContentsViewMac::CreateNewWindowInternal( int route_id, base::WaitableEvent* modal_dialog_event) { - // I don't understand what role this plays in the grand scheme of things. I'm - // not going to fake it. - NOTIMPLEMENTED(); - return NULL; + // 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; } RenderWidgetHostView* WebContentsViewMac::CreateNewWidgetInternal( @@ -209,9 +222,16 @@ void WebContentsViewMac::ShowCreatedWindowInternal( WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { - // I don't understand what role this plays in the grand scheme of things. I'm - // not going to fake it. - NOTIMPLEMENTED(); + 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 WebContentsViewMac::ShowCreatedWidgetInternal( |