| Index: chrome/browser/ui/views/tab_contents/tab_contents_container.cc
|
| diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc
|
| index eed5ea24b47ff47a57d4e6201a0e2e0dc0c4985c..9ab6078d3e03aacb4225e15ca6190ce1068c73e0 100644
|
| --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc
|
| +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc
|
| @@ -12,6 +12,13 @@
|
| #include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
|
| #include "chrome/common/notification_service.h"
|
|
|
| +#if defined(TOUCH_UI)
|
| +#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h"
|
| +#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
|
| +#include "views/border.h"
|
| +#include "views/fill_layout.h"
|
| +#endif
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // TabContentsContainer, public:
|
|
|
| @@ -29,29 +36,46 @@ TabContentsContainer::~TabContentsContainer() {
|
|
|
| void TabContentsContainer::ChangeTabContents(TabContents* contents) {
|
| if (tab_contents_) {
|
| +#if !defined(TOUCH_UI)
|
| native_container_->DetachContents(tab_contents_);
|
| +#endif
|
| 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.
|
| if (tab_contents_) {
|
| +#if defined(TOUCH_UI)
|
| + views::View *v = static_cast<TabContentsViewViews*>(contents->view());
|
| + // Guard against re-adding ourselves, which happens because the NULL
|
| + // value is ignored by the pre-existing if() above.
|
| + if (v->GetParent() != this) {
|
| + AddChildView(v);
|
| + SetLayoutManager(new views::FillLayout());
|
| + Layout();
|
| + }
|
| +#else
|
| RenderWidgetHostViewChanged(
|
| old_contents ? old_contents->GetRenderWidgetHostView() : NULL,
|
| tab_contents_->GetRenderWidgetHostView());
|
| native_container_->AttachContents(tab_contents_);
|
| +#endif
|
| AddObservers();
|
| }
|
| }
|
|
|
| void TabContentsContainer::TabContentsFocused(TabContents* tab_contents) {
|
| - native_container_->TabContentsFocused(tab_contents);
|
| + if (native_container_)
|
| + native_container_->TabContentsFocused(tab_contents);
|
| }
|
|
|
| void TabContentsContainer::SetFastResize(bool fast_resize) {
|
| - native_container_->SetFastResize(fast_resize);
|
| + if (native_container_)
|
| + native_container_->SetFastResize(fast_resize);
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -76,12 +100,16 @@ void TabContentsContainer::Observe(NotificationType type,
|
| // TabContentsContainer, View overrides:
|
|
|
| void TabContentsContainer::Layout() {
|
| +#if defined(TOUCH_UI)
|
| + 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();
|
| }
|
| +#endif
|
| }
|
|
|
| AccessibilityTypes::Role TabContentsContainer::GetAccessibleRole() {
|
| @@ -91,10 +119,14 @@ AccessibilityTypes::Role TabContentsContainer::GetAccessibleRole() {
|
| void TabContentsContainer::ViewHierarchyChanged(bool is_add,
|
| views::View* parent,
|
| views::View* child) {
|
| +#if defined(TOUCH_UI)
|
| + views::View::ViewHierarchyChanged(is_add, parent, child);
|
| +#else
|
| if (is_add && child == this) {
|
| native_container_ = NativeTabContentsContainer::CreateNativeContainer(this);
|
| AddChildView(native_container_->GetView());
|
| }
|
| +#endif
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -119,11 +151,15 @@ void TabContentsContainer::RemoveObservers() {
|
|
|
| void TabContentsContainer::RenderViewHostChanged(RenderViewHost* old_host,
|
| RenderViewHost* new_host) {
|
| +#if defined(TOUCH_UI)
|
| + NOTIMPLEMENTED(); // TODO(anicolao)
|
| +#else
|
| if (new_host) {
|
| RenderWidgetHostViewChanged(
|
| old_host ? old_host->view() : NULL, new_host->view());
|
| }
|
| native_container_->RenderViewHostChanged(old_host, new_host);
|
| +#endif
|
| }
|
|
|
| void TabContentsContainer::TabContentsDestroyed(TabContents* contents) {
|
|
|