diff options
-rw-r--r-- | chrome/browser/browser.cc | 19 | ||||
-rw-r--r-- | chrome/browser/browser.h | 7 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.cc | 8 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_win.cc | 2 |
4 files changed, 34 insertions, 2 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index f3799f6..b9ae5ca 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -2487,14 +2487,29 @@ Browser* Browser::GetOrCreateTabbedBrowser() { void Browser::BuildPopupWindow(TabContents* source, TabContents* new_contents, const gfx::Rect& initial_pos) { - Browser* browser = - new Browser((type_ & TYPE_APP) ? TYPE_APP_POPUP : TYPE_POPUP, profile_); + BuildPopupWindowHelper(source, new_contents, initial_pos, + (type_ & TYPE_APP) ? TYPE_APP_POPUP : TYPE_POPUP, + profile_, false); +} + +void Browser::BuildPopupWindowHelper(TabContents* source, + TabContents* new_contents, + const gfx::Rect& initial_pos, + Browser::Type browser_type, + Profile* profile, + bool start_restored) { + Browser* browser = new Browser(browser_type, profile); browser->set_override_bounds(initial_pos); + + if (start_restored) + browser->set_maximized_state(MAXIMIZED_STATE_UNMAXIMIZED); + browser->CreateBrowserWindow(); // We need to Show before AddNewContents, otherwise AddNewContents will focus // it (via BrowserView::TabSelectedAt calling RestoreFocus), triggering any // onblur="" handlers. browser->window()->Show(); + // TODO(beng): See if this can be made to use // TabStripModel::AppendTabContents. browser->AddNewContents(source, new_contents, NEW_FOREGROUND_TAB, diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 3ac5b47..970886d 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -452,6 +452,13 @@ class Browser : public TabStripModelDelegate, const NotificationSource& source, const NotificationDetails& details); + // Helper function to create a new popup window. + static void BuildPopupWindowHelper(TabContents* source, + TabContents* new_contents, + const gfx::Rect& initial_pos, + Browser::Type browser_type, + Profile* profile, + bool honor_saved_maximized_state); private: // Command and state updating /////////////////////////////////////////////// diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 3ec28a89..521a3bb 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "base/win_util.h" #include "chrome/browser/automation/automation_provider.h" +#include "chrome/browser/browser.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/provisional_load_details.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -213,6 +214,13 @@ void ExternalTabContainer::AddNewContents(TabContents* source, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { + if (disposition == NEW_POPUP || disposition == NEW_WINDOW) { + Browser::BuildPopupWindowHelper(source, new_contents, initial_pos, + Browser::TYPE_POPUP, + tab_contents_->profile(), true); + } else { + NOTREACHED(); + } } void ExternalTabContainer::ActivateContents(TabContents* contents) { diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 6f44e9a..14aee5b 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -493,7 +493,9 @@ void RenderWidgetHostViewWin::OnActivate(UINT action, BOOL minimized, void RenderWidgetHostViewWin::OnDestroy() { ResetTooltip(); TrackMouseLeave(false); +#ifdef ENABLE_TRACK_HWND_DESTRUCTION TRACK_HWND_DESTRUCTION(m_hWnd); +#endif // ENABLE_TRACK_HWND_DESTRUCTION } void RenderWidgetHostViewWin::OnPaint(HDC dc) { |