Make shorter api of AppendVariationHeaders and
CreateSimpleURLLoaderWithVariationHeaders.
Tons of people call AppendVariationHeaders() with variations::SignedIn::kNo with
the following comment:
// Note: It's OK to pass SignedIn::kNo if it's unknown, as it does not affect
// transmission of experiments coming from the variations server.
This CL simply make a version without the sign-in parameter of
AppendVariationHeaders and CreateSimpleULRLoaderWithVariationHeader and remove
those many comments in the code.
BUG=857127
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Id0af5394ce31b117e109033f44a43720d4407197
Reviewed-on: https://chromium-review.googlesource.com/1121669
Commit-Queue: Theresa <[email protected]>
Reviewed-by: Theresa <[email protected]>
Reviewed-by: Zachary Kuznia <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Reviewed-by: Matt Menke <[email protected]>
Reviewed-by: Nicolas Zea <[email protected]>
Reviewed-by: Vaclav Brozek <[email protected]>
Reviewed-by: Mark Cogan <[email protected]>
Reviewed-by: Stepan Khapugin <[email protected]>
Reviewed-by: Samuel Huang <[email protected]>
Reviewed-by: Mathieu Perreault <[email protected]>
Reviewed-by: Alexei Svitkine <[email protected]>
Reviewed-by: Mark Pearson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#573534}
diff --git a/components/variations/net/variations_http_headers.h b/components/variations/net/variations_http_headers.h
index bb3df85..f7c783e 100644
--- a/components/variations/net/variations_http_headers.h
+++ b/components/variations/net/variations_http_headers.h
@@ -41,6 +41,12 @@
SignedIn signed_in,
net::HttpRequestHeaders* headers);
+// Adds Chrome experiment and metrics state as custom headers to |headers|
+// when the signed-in state is not known to the caller; See above for details.
+bool AppendVariationHeadersUnknownSignedIn(const GURL& url,
+ InIncognito incognito,
+ net::HttpRequestHeaders* headers);
+
// Returns the HTTP header names which are added by AppendVariationHeaders().
std::set<std::string> GetVariationHeaderNames();
@@ -60,6 +66,15 @@
SignedIn signed_in,
const net::NetworkTrafficAnnotationTag& annotation_tag);
+// Creates a SimpleURLLoader that will include variations headers for requests
+// to Google when the signed-in state is unknown and ensures they're removed
+// if a redirect to a non-Google URL occurs.
+std::unique_ptr<network::SimpleURLLoader>
+CreateSimpleURLLoaderWithVariationsHeadersUnknownSignedIn(
+ std::unique_ptr<network::ResourceRequest> request,
+ InIncognito incognito,
+ const net::NetworkTrafficAnnotationTag& annotation_tag);
+
namespace internal {
// Checks whether variation headers should be appended to requests to the