Preserve Page::openedByDOM state across process swaps.

Every Page in Blink has an openedByDOM bit which partially determines whether
window.close() may be called. This bit is equivalent to whether the WebContents
was created with an opener. Move this bit up to WebContents and forward it to
new renderers to be preserved across process swaps. Add a suite of tests to
ensure it's preserved correctly.

This also fixes a bug where the bit was not preserved for blocked-then-opened
popups. Add a test for this case.

BUG=357579

Review URL: https://codereview.chromium.org/212703005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264291 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 1b9edf8c..c37e3cf 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -321,6 +321,7 @@
       controller_(this, browser_context),
       render_view_host_delegate_view_(NULL),
       opener_(opener),
+      created_with_opener_(!!opener),
 #if defined(OS_WIN)
       accessible_parent_(NULL),
 #endif
@@ -3739,7 +3740,8 @@
   if (!static_cast<RenderViewHostImpl*>(
           render_view_host)->CreateRenderView(base::string16(),
                                               opener_route_id,
-                                              max_page_id)) {
+                                              max_page_id,
+                                              created_with_opener_)) {
     return false;
   }