Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: content/browser/web_contents/web_contents_view_guest.cc

Issue 618823002: GuestView: Move lifetime management out of content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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(
« no previous file with comments | « content/browser/web_contents/web_contents_view_guest.h ('k') | content/common/browser_plugin/browser_plugin_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698