diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 17:07:23 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 17:07:23 +0000 |
commit | 34ac70504d7090a9689c78fbcadd1a1224fc9cdd (patch) | |
tree | 67aed39edc366610a7f3e56f057d8e7916e6975d /chrome/browser/views/tab_contents | |
parent | 43d4bfc54a2d1ef06281acbb0456f04dcae81c18 (diff) | |
download | chromium_src-34ac70504d7090a9689c78fbcadd1a1224fc9cdd.zip chromium_src-34ac70504d7090a9689c78fbcadd1a1224fc9cdd.tar.gz chromium_src-34ac70504d7090a9689c78fbcadd1a1224fc9cdd.tar.bz2 |
Allow the initial size of TabContentViews to be based on the
size of another TabContents by having an optional TabContents*
passed into the TabContents ctor.
This fixes a race condition where it's possible for a web
page to load before getting the sizing information from the
browser. The new flow passes the size information to the
renderer process before passing the URL to load.
BUG=20159
Review URL: http://codereview.chromium.org/201130
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tab_contents')
4 files changed, 6 insertions, 5 deletions
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc index e39bfde..6a4f76c 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc @@ -117,9 +117,10 @@ TabContentsViewGtk::~TabContentsViewGtk() { CloseNow(); } -void TabContentsViewGtk::CreateView() { +void TabContentsViewGtk::CreateView(const gfx::Size& initial_size) { set_delete_on_destroy(false); - WidgetGtk::Init(NULL, gfx::Rect()); + WidgetGtk::Init(NULL, gfx::Rect(0, 0, initial_size.width(), + initial_size.height())); } RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget( diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h index 8788468..1b03885 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h +++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h @@ -31,7 +31,7 @@ class TabContentsViewGtk : public TabContentsView, // TabContentsView implementation -------------------------------------------- - virtual void CreateView(); + virtual void CreateView(const gfx::Size& initial_size); virtual RenderWidgetHostView* CreateViewForWidget( RenderWidgetHost* render_widget_host); virtual gfx::NativeView GetNativeView() const; diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.cc b/chrome/browser/views/tab_contents/tab_contents_view_win.cc index 9d22dbf..22a1552 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_win.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_win.cc @@ -86,7 +86,7 @@ void TabContentsViewWin::Unparent() { ::SetParent(GetNativeView(), NULL); } -void TabContentsViewWin::CreateView() { +void TabContentsViewWin::CreateView(const gfx::Size& initial_size) { set_delete_on_destroy(false); // Since we create these windows parented to the desktop window initially, we // don't want to create them initially visible. diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.h b/chrome/browser/views/tab_contents/tab_contents_view_win.h index 479f3c4..cf52294 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_win.h +++ b/chrome/browser/views/tab_contents/tab_contents_view_win.h @@ -34,7 +34,7 @@ class TabContentsViewWin : public TabContentsView, // TabContentsView implementation -------------------------------------------- - virtual void CreateView(); + virtual void CreateView(const gfx::Size& initial_size); virtual RenderWidgetHostView* CreateViewForWidget( RenderWidgetHost* render_widget_host); virtual gfx::NativeView GetNativeView() const; |