Index: chrome/browser/views/tab_contents/tab_contents_container.cc |
diff --git a/chrome/browser/views/tab_contents/tab_contents_container.cc b/chrome/browser/views/tab_contents/tab_contents_container.cc |
index a75743dfa343116ccb77270e0f4fffe66f752cff..4518501e92413a91566a74f1185b5f637f69d883 100644 |
--- a/chrome/browser/views/tab_contents/tab_contents_container.cc |
+++ b/chrome/browser/views/tab_contents/tab_contents_container.cc |
@@ -10,6 +10,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/views/tab_contents/native_tab_contents_container_gtk.h" |
+#include "chrome/browser/views/tab_contents/tab_contents_view_views.h" |
+#include "views/border.h" |
+#include "views/fill_layout.h" |
+#endif |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// TabContentsContainer, public: |
@@ -26,7 +33,9 @@ TabContentsContainer::~TabContentsContainer() { |
void TabContentsContainer::ChangeTabContents(TabContents* contents) { |
if (tab_contents_) { |
+#if !defined(TOUCH_UI) |
native_container_->DetachContents(tab_contents_); |
+#endif |
tab_contents_->WasHidden(); |
RemoveObservers(); |
} |
@@ -34,17 +43,30 @@ void TabContentsContainer::ChangeTabContents(TabContents* 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 = (TabContentsViewViews*)contents->view(); |
oshima
2010/11/08 20:59:38
static_cast
|
+ // 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(); |
oshima
2010/11/08 20:59:38
do you need to set layout manager everytime?
Also
Alex Nicolaou
2010/11/12 04:05:00
I moved these into the if(...)
Probably I don't n
|
+#else |
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); |
} |
//////////////////////////////////////////////////////////////////////////////// |
@@ -69,10 +91,14 @@ void TabContentsContainer::Observe(NotificationType type, |
// TabContentsContainer, View overrides: |
void TabContentsContainer::Layout() { |
+#if defined(TOUCH_UI) |
+ views::View::Layout(); |
+#else |
if (native_container_) { |
native_container_->GetView()->SetBounds(0, 0, width(), height()); |
native_container_->GetView()->Layout(); |
} |
+#endif |
} |
AccessibilityTypes::Role TabContentsContainer::GetAccessibleRole() { |
@@ -82,10 +108,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 |
} |
//////////////////////////////////////////////////////////////////////////////// |
@@ -110,7 +140,11 @@ void TabContentsContainer::RemoveObservers() { |
void TabContentsContainer::RenderViewHostChanged(RenderViewHost* old_host, |
RenderViewHost* new_host) { |
+#if defined(TOUCH_UI) |
+ NOTIMPLEMENTED(); // TODO(anicolao) |
+#else |
native_container_->RenderViewHostChanged(old_host, new_host); |
+#endif |
} |
void TabContentsContainer::TabContentsDestroyed(TabContents* contents) { |