blob: fe4d597e7363ec8b06f4b8d7a8a9a0b937677370 [file] [log] [blame]
asvitkine9a279832015-12-18 02:35:501// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_
6#define COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_
7
8#include <set>
9#include <string>
10
11namespace net {
12class HttpRequestHeaders;
13}
14
15class GURL;
16
17namespace variations {
18
19// Adds Chrome experiment and metrics state as custom headers to |headers|.
yutak3305f49d2016-12-13 10:32:3120// The content of the headers will depend on |incognito|, |uma_enabled| and
21// |is_signed_in| parameters. It is fine to pass false for |is_signed_in| if the
22// state is not known to the caller. This will prevent addition of ids of type
23// GOOGLE_WEB_PROPERTIES_SIGNED_IN, which is not the case for any ids that come
24// from the variations server. These headers are never transmitted to non-Google
25// web sites, which is checked based on the destination |url|.
asvitkine9a279832015-12-18 02:35:5026void AppendVariationHeaders(const GURL& url,
27 bool incognito,
28 bool uma_enabled,
yutak3305f49d2016-12-13 10:32:3129 bool is_signed_in,
asvitkine9a279832015-12-18 02:35:5030 net::HttpRequestHeaders* headers);
31
32// Returns the HTTP header names which are added by AppendVariationHeaders().
33std::set<std::string> GetVariationHeaderNames();
34
35namespace internal {
36
37// Checks whether variation headers should be appended to requests to the
38// specified |url|. Returns true for google.<TLD> and youtube.<TLD> URLs.
39bool ShouldAppendVariationHeaders(const GURL& url);
40
41} // namespace internal
42
43} // namespace variations
44
45#endif // COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_