| Index: chrome/browser/ui/views/dom_view.cc
|
| diff --git a/chrome/browser/ui/views/dom_view.cc b/chrome/browser/ui/views/dom_view.cc
|
| index a4cc19af2b80485a088d903a03d5cf589cc5eb6a..24275fa06bfefcbcd2599806845407e3d29ace34 100644
|
| --- a/chrome/browser/ui/views/dom_view.cc
|
| +++ b/chrome/browser/ui/views/dom_view.cc
|
| @@ -14,7 +14,7 @@ DOMView::DOMView() : tab_contents_(NULL), initialized_(false) {
|
|
|
| DOMView::~DOMView() {
|
| if (native_view())
|
| - Detach();
|
| + DetachTabContents();
|
| }
|
|
|
| bool DOMView::Init(Profile* profile, SiteInstance* instance) {
|
| @@ -25,7 +25,7 @@ bool DOMView::Init(Profile* profile, SiteInstance* instance) {
|
| tab_contents_.reset(CreateTabContents(profile, instance));
|
| // Attach the native_view now if the view is already added to Widget.
|
| if (GetWidget())
|
| - Attach(tab_contents_->GetNativeView());
|
| + AttachTabContents();
|
| return true;
|
| }
|
|
|
| @@ -56,7 +56,19 @@ void DOMView::ViewHierarchyChanged(bool is_add, views::View* parent,
|
| // the native view has not been attached yet and tab_contents_ exists.
|
| views::NativeViewHost::ViewHierarchyChanged(is_add, parent, child);
|
| if (is_add && GetWidget() && !native_view() && tab_contents_.get())
|
| - Attach(tab_contents_->GetNativeView());
|
| + AttachTabContents();
|
| else if (!is_add && child == this && native_view())
|
| - Detach();
|
| + DetachTabContents();
|
| +}
|
| +
|
| +void DOMView::AttachTabContents() {
|
| +#if defined(TOUCH_UI)
|
| + AttachToView(tab_contents_->GetViewsView());
|
| +#else
|
| + Attach(tab_contents_->GetNativeView());
|
| +#endif
|
| +}
|
| +
|
| +void DOMView::DetachTabContents() {
|
| + Detach();
|
| }
|
|
|