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

Side by Side Diff: components/variations/net/variations_http_headers.cc

Issue 2558913003: Restrict transmission of external exp ids to signed in users. (Closed)
Patch Set: Address nit. Created 4 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 unified diff | Download patch
OLDNEW
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 #include "components/variations/net/variations_http_headers.h" 5 #include "components/variations/net/variations_http_headers.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 26 matching lines...) Expand all
37 }; 37 };
38 38
39 const char kChromeUMAEnabled[] = "X-Chrome-UMA-Enabled"; 39 const char kChromeUMAEnabled[] = "X-Chrome-UMA-Enabled";
40 const char kClientData[] = "X-Client-Data"; 40 const char kClientData[] = "X-Client-Data";
41 41
42 } // namespace 42 } // namespace
43 43
44 void AppendVariationHeaders(const GURL& url, 44 void AppendVariationHeaders(const GURL& url,
45 bool incognito, 45 bool incognito,
46 bool uma_enabled, 46 bool uma_enabled,
47 bool is_signed_in,
47 net::HttpRequestHeaders* headers) { 48 net::HttpRequestHeaders* headers) {
48 // Note the criteria for attaching client experiment headers: 49 // Note the criteria for attaching client experiment headers:
49 // 1. We only transmit to Google owned domains which can evaluate experiments. 50 // 1. We only transmit to Google owned domains which can evaluate experiments.
50 // 1a. These include hosts which have a standard postfix such as: 51 // 1a. These include hosts which have a standard postfix such as:
51 // *.doubleclick.net or *.googlesyndication.com or 52 // *.doubleclick.net or *.googlesyndication.com or
52 // exactly www.googleadservices.com or 53 // exactly www.googleadservices.com or
53 // international TLD domains *.google.<TLD> or *.youtube.<TLD>. 54 // international TLD domains *.google.<TLD> or *.youtube.<TLD>.
54 // 2. Only transmit for non-Incognito profiles. 55 // 2. Only transmit for non-Incognito profiles.
55 // 3. For the X-Chrome-UMA-Enabled bit, only set it if UMA is in fact enabled 56 // 3. For the X-Chrome-UMA-Enabled bit, only set it if UMA is in fact enabled
56 // for this install of Chrome. 57 // for this install of Chrome.
57 // 4. For the X-Client-Data header, only include non-empty variation IDs. 58 // 4. For the X-Client-Data header, only include non-empty variation IDs.
58 if (incognito || !internal::ShouldAppendVariationHeaders(url)) 59 if (incognito || !internal::ShouldAppendVariationHeaders(url))
59 return; 60 return;
60 61
61 if (uma_enabled) 62 if (uma_enabled)
62 headers->SetHeaderIfMissing(kChromeUMAEnabled, "1"); 63 headers->SetHeaderIfMissing(kChromeUMAEnabled, "1");
63 64
64 const std::string variation_ids_header = 65 const std::string variation_ids_header =
65 VariationsHttpHeaderProvider::GetInstance()->GetClientDataHeader(); 66 VariationsHttpHeaderProvider::GetInstance()->GetClientDataHeader(
67 is_signed_in);
66 if (!variation_ids_header.empty()) { 68 if (!variation_ids_header.empty()) {
67 // Note that prior to M33 this header was named X-Chrome-Variations. 69 // Note that prior to M33 this header was named X-Chrome-Variations.
68 headers->SetHeaderIfMissing(kClientData, variation_ids_header); 70 headers->SetHeaderIfMissing(kClientData, variation_ids_header);
69 } 71 }
70 } 72 }
71 73
72 std::set<std::string> GetVariationHeaderNames() { 74 std::set<std::string> GetVariationHeaderNames() {
73 std::set<std::string> headers; 75 std::set<std::string> headers;
74 headers.insert(kChromeUMAEnabled); 76 headers.insert(kChromeUMAEnabled);
75 headers.insert(kClientData); 77 headers.insert(kClientData);
(...skipping 25 matching lines...) Expand all
101 return true; 103 return true;
102 } 104 }
103 105
104 return google_util::IsYoutubeDomainUrl(url, google_util::ALLOW_SUBDOMAIN, 106 return google_util::IsYoutubeDomainUrl(url, google_util::ALLOW_SUBDOMAIN,
105 google_util::ALLOW_NON_STANDARD_PORTS); 107 google_util::ALLOW_NON_STANDARD_PORTS);
106 } 108 }
107 109
108 } // namespace internal 110 } // namespace internal
109 111
110 } // namespace variations 112 } // namespace variations
OLDNEW
« no previous file with comments | « components/variations/net/variations_http_headers.h ('k') | components/variations/variations_associated_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698