summaryrefslogtreecommitdiffstats
path: root/components/variations/net/variations_http_headers.h
diff options
context:
space:
mode:
Diffstat (limited to 'components/variations/net/variations_http_headers.h')
-rw-r--r--components/variations/net/variations_http_headers.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/components/variations/net/variations_http_headers.h b/components/variations/net/variations_http_headers.h
new file mode 100644
index 0000000..d6280e5
--- /dev/null
+++ b/components/variations/net/variations_http_headers.h
@@ -0,0 +1,41 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_
+#define COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_
+
+#include <set>
+#include <string>
+
+namespace net {
+class HttpRequestHeaders;
+}
+
+class GURL;
+
+namespace variations {
+
+// Adds Chrome experiment and metrics state as custom headers to |headers|.
+// Some headers may not be set given the |incognito| mode or whether
+// the user has |uma_enabled|. Also, we never transmit headers to non-Google
+// sites, which is checked based on the destination |url|.
+void AppendVariationHeaders(const GURL& url,
+ bool incognito,
+ bool uma_enabled,
+ net::HttpRequestHeaders* headers);
+
+// Returns the HTTP header names which are added by AppendVariationHeaders().
+std::set<std::string> GetVariationHeaderNames();
+
+namespace internal {
+
+// Checks whether variation headers should be appended to requests to the
+// specified |url|. Returns true for google.<TLD> and youtube.<TLD> URLs.
+bool ShouldAppendVariationHeaders(const GURL& url);
+
+} // namespace internal
+
+} // namespace variations
+
+#endif // COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_