Fix RenderFrameCreated and RenderFrameDeleted WebContentsObserver methods
The RenderFrameCreated and RenderFrameDeleted observer methods aren't
matching the lifetime of the renderer-side RenderFrame object. This CL
fixes the methods to be called at the right times to match.
BUG=450799, 425397
Review URL: https://codereview.chromium.org/921443003
Cr-Commit-Position: refs/heads/master@{#317792}
diff --git a/content/public/browser/web_contents.cc b/content/public/browser/web_contents.cc
index 6768411..aece7c6 100644
--- a/content/public/browser/web_contents.cc
+++ b/content/public/browser/web_contents.cc
@@ -17,7 +17,8 @@
main_frame_routing_id(MSG_ROUTING_NONE),
initially_hidden(false),
guest_delegate(nullptr),
- context(nullptr) {}
+ context(nullptr),
+ renderer_initiated_creation(false) {}
WebContents::CreateParams::CreateParams(
BrowserContext* context, SiteInstance* site)
@@ -29,7 +30,8 @@
main_frame_routing_id(MSG_ROUTING_NONE),
initially_hidden(false),
guest_delegate(nullptr),
- context(nullptr) {}
+ context(nullptr),
+ renderer_initiated_creation(false) {}
WebContents::CreateParams::~CreateParams() {
}
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 879e8d8..493abd8 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -122,6 +122,12 @@
// Used to specify the location context which display the new view should
// belong. This can be nullptr if not needed.
gfx::NativeView context;
+
+ // Used to specify that the new WebContents creation is driven by the
+ // renderer process. In this case, the renderer-side objects, such as
+ // RenderFrame, have already been created on the renderer side, and
+ // WebContents construction should take this into account.
+ bool renderer_initiated_creation;
};
// Creates a new WebContents.