| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_ | 5 #ifndef COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_ | 
| 6 #define COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_ | 6 #define COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_ | 
| 7 | 7 | 
| 8 #include <set> | 8 #include <set> | 
| 9 #include <string> | 9 #include <string> | 
| 10 | 10 | 
| 11 namespace net { | 11 namespace net { | 
| 12 class HttpRequestHeaders; | 12 class HttpRequestHeaders; | 
| 13 } | 13 } | 
| 14 | 14 | 
| 15 class GURL; | 15 class GURL; | 
| 16 | 16 | 
| 17 namespace variations { | 17 namespace variations { | 
| 18 | 18 | 
| 19 // Adds Chrome experiment and metrics state as custom headers to |headers|. | 19 // Adds Chrome experiment and metrics state as custom headers to |headers|. | 
| 20 // Some headers may not be set given the |incognito| mode or whether | 20 // The content of the headers will depend on |incognito|, |uma_enabled| and | 
| 21 // the user has |uma_enabled|.  Also, we never transmit headers to non-Google | 21 // |is_signed_in| parameters. It is fine to pass false for |is_signed_in| if the | 
| 22 // sites, which is checked based on the destination |url|. | 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|. | 
| 23 void AppendVariationHeaders(const GURL& url, | 26 void AppendVariationHeaders(const GURL& url, | 
| 24                             bool incognito, | 27                             bool incognito, | 
| 25                             bool uma_enabled, | 28                             bool uma_enabled, | 
|  | 29                             bool is_signed_in, | 
| 26                             net::HttpRequestHeaders* headers); | 30                             net::HttpRequestHeaders* headers); | 
| 27 | 31 | 
| 28 // Returns the HTTP header names which are added by AppendVariationHeaders(). | 32 // Returns the HTTP header names which are added by AppendVariationHeaders(). | 
| 29 std::set<std::string> GetVariationHeaderNames(); | 33 std::set<std::string> GetVariationHeaderNames(); | 
| 30 | 34 | 
| 31 namespace internal { | 35 namespace internal { | 
| 32 | 36 | 
| 33 // Checks whether variation headers should be appended to requests to the | 37 // Checks whether variation headers should be appended to requests to the | 
| 34 // specified |url|. Returns true for google.<TLD> and youtube.<TLD> URLs. | 38 // specified |url|. Returns true for google.<TLD> and youtube.<TLD> URLs. | 
| 35 bool ShouldAppendVariationHeaders(const GURL& url); | 39 bool ShouldAppendVariationHeaders(const GURL& url); | 
| 36 | 40 | 
| 37 }  // namespace internal | 41 }  // namespace internal | 
| 38 | 42 | 
| 39 }  // namespace variations | 43 }  // namespace variations | 
| 40 | 44 | 
| 41 #endif  // COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_ | 45 #endif  // COMPONENTS_VARIATIONS_NET_VARIATIONS_HTTP_HEADERS_H_ | 
| OLD | NEW | 
|---|