| Index: chrome/browser/ui/views/tab_contents/tab_contents_container.cc
|
| ===================================================================
|
| --- chrome/browser/ui/views/tab_contents/tab_contents_container.cc (revision 71251)
|
| +++ chrome/browser/ui/views/tab_contents/tab_contents_container.cc (working copy)
|
| @@ -25,7 +25,8 @@
|
|
|
| TabContentsContainer::TabContentsContainer()
|
| : native_container_(NULL),
|
| - tab_contents_(NULL) {
|
| + tab_contents_(NULL),
|
| + reserved_area_delegate_(NULL) {
|
| SetID(VIEW_ID_TAB_CONTAINER);
|
| }
|
|
|
| @@ -45,6 +46,9 @@
|
| tab_contents_->WasHidden();
|
| RemoveObservers();
|
| }
|
| +#if !defined(TOUCH_UI)
|
| + TabContents* old_contents = tab_contents_;
|
| +#endif
|
| tab_contents_ = contents;
|
| // When detaching the last tab of the browser ChangeTabContents is invoked
|
| // with NULL. Don't attempt to do anything in that case.
|
| @@ -59,7 +63,9 @@
|
| Layout();
|
| }
|
| #else
|
| - RenderWidgetHostViewChanged(tab_contents_->GetRenderWidgetHostView());
|
| + RenderWidgetHostViewChanged(
|
| + old_contents ? old_contents->GetRenderWidgetHostView() : NULL,
|
| + tab_contents_->GetRenderWidgetHostView());
|
| native_container_->AttachContents(tab_contents_);
|
| #endif
|
| AddObservers();
|
| @@ -76,17 +82,6 @@
|
| native_container_->SetFastResize(fast_resize);
|
| }
|
|
|
| -void TabContentsContainer::SetReservedContentsRect(
|
| - const gfx::Rect& reserved_rect) {
|
| - cached_reserved_rect_ = reserved_rect;
|
| -#if !defined(TOUCH_UI)
|
| - if (tab_contents_ && tab_contents_->GetRenderWidgetHostView()) {
|
| - tab_contents_->GetRenderWidgetHostView()->set_reserved_contents_rect(
|
| - reserved_rect);
|
| - }
|
| -#endif
|
| -}
|
| -
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // TabContentsContainer, NotificationObserver implementation:
|
|
|
| @@ -113,6 +108,8 @@
|
| views::View::Layout();
|
| #else
|
| if (native_container_) {
|
| + if (reserved_area_delegate_)
|
| + reserved_area_delegate_->UpdateReservedContentsRect(this);
|
| native_container_->GetView()->SetBounds(0, 0, width(), height());
|
| native_container_->GetView()->Layout();
|
| }
|
| @@ -161,8 +158,10 @@
|
| #if defined(TOUCH_UI)
|
| NOTIMPLEMENTED(); // TODO(anicolao)
|
| #else
|
| - if (new_host)
|
| - RenderWidgetHostViewChanged(new_host->view());
|
| + if (new_host) {
|
| + RenderWidgetHostViewChanged(
|
| + old_host ? old_host->view() : NULL, new_host->view());
|
| + }
|
| native_container_->RenderViewHostChanged(old_host, new_host);
|
| #endif
|
| }
|
| @@ -175,7 +174,12 @@
|
| }
|
|
|
| void TabContentsContainer::RenderWidgetHostViewChanged(
|
| - RenderWidgetHostView* new_view) {
|
| - if (new_view)
|
| - new_view->set_reserved_contents_rect(cached_reserved_rect_);
|
| + RenderWidgetHostView* old_view, RenderWidgetHostView* new_view) {
|
| + // Carry over the reserved rect, if possible.
|
| + if (old_view && new_view) {
|
| + new_view->set_reserved_contents_rect(old_view->reserved_contents_rect());
|
| + } else {
|
| + if (reserved_area_delegate_)
|
| + reserved_area_delegate_->UpdateReservedContentsRect(this);
|
| + }
|
| }
|
|
|