Add anonymous iframe WebFeature.

This is required to setup an OriginTrial.

[email protected]
[email protected]

Fixed: 1318042
Change-Id: Ibdc1775a93da44605ecb4ac6d0e38a8cbb77b8de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3616804
Reviewed-by: Antonio Sartori <[email protected]>
Commit-Queue: Arthur Sonzogni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#998282}
diff --git a/content/browser/renderer_host/frame_tree_node.cc b/content/browser/renderer_host/frame_tree_node.cc
index 9c3b109..aa65812 100644
--- a/content/browser/renderer_host/frame_tree_node.cc
+++ b/content/browser/renderer_host/frame_tree_node.cc
@@ -501,6 +501,21 @@
   }
 }
 
+void FrameTreeNode::SetAnonymous(bool anonymous) {
+  if (anonymous) {
+    if (!parent_) {
+      bad_message::ReceivedBadMessage(current_frame_host()->GetProcess(),
+                                      bad_message::FTN_ANONYMOUS);
+      return;
+    }
+
+    GetContentClient()->browser()->LogWebFeatureForCurrentPage(
+        parent_, blink::mojom::WebFeature::kAnonymousIframe);
+  }
+
+  anonymous_ = anonymous;
+}
+
 bool FrameTreeNode::IsLoading() const {
   RenderFrameHostImpl* current_frame_host =
       render_manager_.current_frame_host();