Index: content/browser/web_contents/web_contents_view_guest.cc |
diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc |
index efa92bdc0ee4ae7421bf6e52c1c51dc31371b905..17a5c484ef6a3416420157ee9064a12cc3e91434 100644 |
--- a/content/browser/web_contents/web_contents_view_guest.cc |
+++ b/content/browser/web_contents/web_contents_view_guest.cc |
@@ -60,7 +60,7 @@ gfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const { |
return guest_->embedder_web_contents()->GetTopLevelNativeWindow(); |
} |
-void WebContentsViewGuest::OnGuestInitialized(WebContentsView* parent_view) { |
+void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) { |
#if defined(USE_AURA) |
// In aura, ScreenPositionClient doesn't work properly if we do |
// not have the native view associated with this WebContentsViewGuest in the |
@@ -71,6 +71,13 @@ void WebContentsViewGuest::OnGuestInitialized(WebContentsView* parent_view) { |
#endif // defined(USE_AURA) |
} |
+void WebContentsViewGuest::OnGuestDetached(WebContentsView* old_parent_view) { |
+#if defined(USE_AURA) |
+ old_parent_view->GetNativeView()->RemoveChild( |
+ platform_view_->GetNativeView()); |
+#endif // defined(USE_AURA) |
+} |
+ |
ContextMenuParams WebContentsViewGuest::ConvertContextMenuParams( |
const ContextMenuParams& params) const { |
// We need to add |offset| of the guest from the embedder to position the |
@@ -143,12 +150,9 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( |
RenderWidgetHostViewBase* platform_widget = |
platform_view_->CreateViewForWidget(render_widget_host); |
- RenderWidgetHostViewBase* view = new RenderWidgetHostViewGuest( |
- render_widget_host, |
- guest_, |
- platform_widget); |
- |
- return view; |
+ return new RenderWidgetHostViewGuest(render_widget_host, |
+ guest_, |
+ platform_widget); |
} |
RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForPopupWidget( |