Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: components/variations/net/variations_http_headers.h

Issue 1530133005: Refactor VariationsHttpHeaderProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing include to srt_fetcher_win.cc. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/variations/net/variations_http_headers.h
diff --git a/components/variations/net/variations_http_headers.h b/components/variations/net/variations_http_headers.h
new file mode 100644
index 0000000000000000000000000000000000000000..d6280e56e8e0584e4cdad1a803ca7a38e46b88b7
--- /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_

Powered by Google App Engine
This is Rietveld 408576698