Feature Policy Onion Soup (4)

Moved content/common/frame_policy.* to third_party/WebKit/common
Because FramePolicy includes WebSandboxFlags, also moved WebSandboxFlags.h to
third_party/WebKit/common/sandbox_flags.h

See Feature Policy Onion Soup (1) at:
https://chromium-review.googlesource.com/c/chromium/src/+/726343
See Feature Policy Onion Soup (2) at:
https://chromium-review.googlesource.com/c/chromium/src/+/742421
See Feature Policy Onion Soup (3) at:
https://chromium-review.googlesource.com/c/chromium/src/+/742601

Bug: 561879
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_dbg_ng;master.tryserver.chromium.linux:linux_site_isolation
Change-Id: I3279b9cc7ca814515481d40b788a41c1f625ac32
Reviewed-on: https://chromium-review.googlesource.com/749783
Reviewed-by: Colin Blundell <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Commit-Queue: Luna Lu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#514750}
diff --git a/content/browser/frame_host/frame_tree_unittest.cc b/content/browser/frame_host/frame_tree_unittest.cc
index 7d885eab..8cd072a2 100644
--- a/content/browser/frame_host/frame_tree_unittest.cc
+++ b/content/browser/frame_host/frame_tree_unittest.cc
@@ -16,7 +16,6 @@
 #include "content/browser/web_contents/web_contents_impl.h"
 #include "content/common/frame_messages.h"
 #include "content/common/frame_owner_properties.h"
-#include "content/common/frame_policy.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/test/mock_render_process_host.h"
 #include "content/public/test/test_browser_context.h"
@@ -25,6 +24,7 @@
 #include "content/test/test_render_view_host.h"
 #include "content/test/test_web_contents.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/common/frame_policy.h"
 
 namespace content {
 
@@ -162,30 +162,36 @@
   EXPECT_EQ("2: []", GetTreeState(frame_tree));
 
   // Simulate attaching a series of frames to build the frame tree.
-  frame_tree->AddFrame(
-      root, process_id, 14, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      root, process_id, 15, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      root, process_id, 16, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      root->child_at(0), process_id, 244, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName3",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      root->child_at(1), process_id, 255, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, no_children_node, "uniqueName4",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      root->child_at(0), process_id, 245, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName5",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(root, process_id, 14,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName0", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(root, process_id, 15,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName1", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(root, process_id, 16,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName2", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(root->child_at(0), process_id, 244,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName3", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(root->child_at(1), process_id, 255,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, no_children_node,
+                       "uniqueName4", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(root->child_at(0), process_id, 245,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName5", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
 
   EXPECT_EQ(
       "2: [14: [244: [], 245: []], "
@@ -194,47 +200,53 @@
       GetTreeState(frame_tree));
 
   FrameTreeNode* child_16 = root->child_at(2);
-  frame_tree->AddFrame(
-      child_16, process_id, 264, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName6",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      child_16, process_id, 265, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName7",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      child_16, process_id, 266, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName8",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      child_16, process_id, 267, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, deep_subtree, "uniqueName9",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
-  frame_tree->AddFrame(
-      child_16, process_id, 268, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName10",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(child_16, process_id, 264,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName6", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(child_16, process_id, 265,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName7", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(child_16, process_id, 266,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName8", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(child_16, process_id, 267,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, deep_subtree,
+                       "uniqueName9", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(child_16, process_id, 268,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName10", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
 
   FrameTreeNode* child_267 = child_16->child_at(3);
-  frame_tree->AddFrame(
-      child_267, process_id, 365, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName11",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+  frame_tree->AddFrame(child_267, process_id, 365,
+                       CreateStubInterfaceProviderRequest(),
+                       blink::WebTreeScopeType::kDocument, std::string(),
+                       "uniqueName11", base::UnguessableToken::Create(),
+                       blink::FramePolicy(), FrameOwnerProperties());
   frame_tree->AddFrame(child_267->child_at(0), process_id, 455,
                        CreateStubInterfaceProviderRequest(),
                        blink::WebTreeScopeType::kDocument, std::string(),
                        "uniqueName12", base::UnguessableToken::Create(),
-                       FramePolicy(), FrameOwnerProperties());
+                       blink::FramePolicy(), FrameOwnerProperties());
   frame_tree->AddFrame(child_267->child_at(0)->child_at(0), process_id, 555,
                        CreateStubInterfaceProviderRequest(),
                        blink::WebTreeScopeType::kDocument, std::string(),
                        "uniqueName13", base::UnguessableToken::Create(),
-                       FramePolicy(), FrameOwnerProperties());
+                       blink::FramePolicy(), FrameOwnerProperties());
   frame_tree->AddFrame(child_267->child_at(0)->child_at(0)->child_at(0),
                        process_id, 655, CreateStubInterfaceProviderRequest(),
                        blink::WebTreeScopeType::kDocument, std::string(),
                        "uniqueName14", base::UnguessableToken::Create(),
-                       FramePolicy(), FrameOwnerProperties());
+                       blink::FramePolicy(), FrameOwnerProperties());
 
   // Now that's it's fully built, verify the tree structure is as expected.
   EXPECT_EQ(
@@ -308,15 +320,18 @@
   main_test_rfh()->OnCreateChildFrame(
       22, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, "child0", "uniqueName0",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   main_test_rfh()->OnCreateChildFrame(
       23, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, "child1", "uniqueName1",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   main_test_rfh()->OnCreateChildFrame(
       24, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   FrameTreeNode* child0 = root->child_at(0);
   FrameTreeNode* child1 = root->child_at(1);
   FrameTreeNode* child2 = root->child_at(2);
@@ -325,7 +340,8 @@
   child1->current_frame_host()->OnCreateChildFrame(
       33, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, "grandchild", "uniqueName3",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   FrameTreeNode* grandchild = child1->child_at(0);
 
   // Ensure they can be found by FTN id.
@@ -364,15 +380,18 @@
   main_test_rfh()->OnCreateChildFrame(
       22, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, "child0", "uniqueName0",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   main_test_rfh()->OnCreateChildFrame(
       23, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, "child1", "uniqueName1",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   main_test_rfh()->OnCreateChildFrame(
       24, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, "child2", "uniqueName2",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   FrameTreeNode* child0 = root->child_at(0);
   FrameTreeNode* child1 = root->child_at(1);
   FrameTreeNode* child2 = root->child_at(2);
@@ -381,7 +400,8 @@
   child1->current_frame_host()->OnCreateChildFrame(
       33, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, "grandchild", "uniqueName3",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   FrameTreeNode* grandchild = child1->child_at(0);
 
   // Test PreviousSibling().
@@ -413,7 +433,8 @@
   main_test_rfh()->OnCreateChildFrame(
       14, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   EXPECT_EQ(
       "RenderFrameHostChanged(new)(14) -> 2: []\n"
       "RenderFrameCreated(14) -> 2: [14: []]",
@@ -421,7 +442,8 @@
   main_test_rfh()->OnCreateChildFrame(
       18, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   EXPECT_EQ(
       "RenderFrameHostChanged(new)(18) -> 2: [14: []]\n"
       "RenderFrameCreated(18) -> 2: [14: [], 18: []]",
@@ -442,7 +464,8 @@
   main_test_rfh()->OnCreateChildFrame(
       22, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   EXPECT_EQ(
       "RenderFrameHostChanged(new)(22) -> 2: []\n"
       "RenderFrameCreated(22) -> 2: [22: []]",
@@ -450,7 +473,8 @@
   main_test_rfh()->OnCreateChildFrame(
       23, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   EXPECT_EQ(
       "RenderFrameHostChanged(new)(23) -> 2: [22: []]\n"
       "RenderFrameCreated(23) -> 2: [22: [], 23: []]",
@@ -480,7 +504,8 @@
   ASSERT_FALSE(frame_tree->AddFrame(
       root, process_id + 1, 1, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties()));
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties()));
   ASSERT_EQ("2: []", GetTreeState(frame_tree));
 }
 
@@ -495,18 +520,21 @@
   main_test_rfh()->OnCreateChildFrame(
       22, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
   main_test_rfh()->OnCreateChildFrame(
       23, CreateStubInterfaceProviderRequest(),
       blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+      base::UnguessableToken::Create(), blink::FramePolicy(),
+      FrameOwnerProperties());
 
   // Add one grandchild frame.
   RenderFrameHostImpl* child1_rfh = root->child_at(0)->current_frame_host();
-  child1_rfh->OnCreateChildFrame(
-      33, CreateStubInterfaceProviderRequest(),
-      blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2",
-      base::UnguessableToken::Create(), FramePolicy(), FrameOwnerProperties());
+  child1_rfh->OnCreateChildFrame(33, CreateStubInterfaceProviderRequest(),
+                                 blink::WebTreeScopeType::kDocument,
+                                 std::string(), "uniqueName2",
+                                 base::UnguessableToken::Create(),
+                                 blink::FramePolicy(), FrameOwnerProperties());
 
   // Ensure they can be found by id.
   int id1 = root->child_at(0)->frame_tree_node_id();