Add OT to append BFcache experiment state HTTP header to resource requests

We’re running an experiment that enables the back-forward cache for
same-site navigations. Websites might be interested to know whether a
page they’re serving is included in the experiment (which means the page
might get stored into the back-forward cache and later restored) for
analytics purposes (e.g. analyzing user behavior with back-forward
cache enabled vs not).

When a page opts-in into the Origin Trial, we will send a
“Sec-bfcache-experiment” HTTP header on resource requests made by the
page. The value will be set to the experiment group that the page is
currently in (e.g. "experiment1-enabled", "experiment1-control",
"experiment1-default")

This CL adds the "BackForwardCacheExperimentHTTPHeader" Origin Trial
feature and the "BackForwardCacheSameSite" feature to pass the info on
whether same-site bfcache is enabled or not from content/ to blink/.

This HTTP header will be removed after the Origin Trial and BFCache
experiments ended.

I2E: https://groups.google.com/a/chromium.org/g/blink-dev/c/RXxETBGaTYI/m/qJI6p9n_CQAJ

Bug: 1121976
Change-Id: Ifc65908b55ae7aa726f9fc8d7a7c18bb4db23c7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2371148
Commit-Queue: Rakina Zata Amni <[email protected]>
Reviewed-by: Alexander Timin <[email protected]>
Reviewed-by: Yutaka Hirano <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Cr-Commit-Position: refs/heads/master@{#802223}
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
index 80fb5c6..63a16660 100644
--- a/third_party/blink/common/features.cc
+++ b/third_party/blink/common/features.cc
@@ -744,5 +744,15 @@
 const base::Feature kTransferableStreams{"TransferableStreams",
                                          base::FEATURE_DISABLED_BY_DEFAULT};
 
+// The "BackForwardCacheABExperimentControl" feature indicates the state of the
+// same-site BackForwardCache experiment. This information is used when sending
+// the "Sec-bfcache-experiment" HTTP Header on resource requests. The header
+// value is determined by the value of the "experiment_group_for_http_header"
+// feature parameter.
+const base::Feature kBackForwardCacheABExperimentControl{
+    "BackForwardCacheABExperimentControl", base::FEATURE_DISABLED_BY_DEFAULT};
+const char kBackForwardCacheABExperimentGroup[] =
+    "experiment_group_for_http_header";
+
 }  // namespace features
 }  // namespace blink