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

Unified Diff: components/variations/net/variations_http_header_provider.cc

Issue 666973003: [ServiceWorker] Don't send the UMA related headers to the ServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: introudce ServiceWorkerContext::AddExcludedHeaderNameForFetchEvent Created 6 years, 2 months 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_header_provider.cc
diff --git a/components/variations/net/variations_http_header_provider.cc b/components/variations/net/variations_http_header_provider.cc
index 1220fae1640fc55545dfd978226b677ab3ebb0f3..0ce748aff038159a423cb11d85bd63df9120454f 100644
--- a/components/variations/net/variations_http_header_provider.cc
+++ b/components/variations/net/variations_http_header_provider.cc
@@ -14,6 +14,7 @@
#include "base/strings/string_util.h"
#include "components/google/core/browser/google_util.h"
#include "components/variations/proto/client_variations.pb.h"
+#include "content/public/browser/service_worker_context.h"
Alexei Svitkine (slow) 2014/10/27 15:09:00 Hmm, I don't think we want to do this. This code
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/http/http_request_headers.h"
#include "url/gurl.h"
@@ -36,6 +37,9 @@ const char* kSuffixesToSetHeadersFor[] = {
".ytimg.com",
};
+const char kChromeUMAEnabled[] = "X-Chrome-UMA-Enabled";
+const char kClientData[] = "X-Client-Data";
+
} // namespace
VariationsHttpHeaderProvider* VariationsHttpHeaderProvider::GetInstance() {
@@ -61,7 +65,7 @@ void VariationsHttpHeaderProvider::AppendHeaders(
return;
if (uma_enabled)
- headers->SetHeaderIfMissing("X-Chrome-UMA-Enabled", "1");
+ headers->SetHeaderIfMissing(kChromeUMAEnabled, "1");
// Lazily initialize the header, if not already done, before attempting to
// transmit it.
@@ -75,8 +79,7 @@ void VariationsHttpHeaderProvider::AppendHeaders(
if (!variation_ids_header_copy.empty()) {
// Note that prior to M33 this header was named X-Chrome-Variations.
- headers->SetHeaderIfMissing("X-Client-Data",
- variation_ids_header_copy);
+ headers->SetHeaderIfMissing(kClientData, variation_ids_header_copy);
}
}
@@ -113,6 +116,10 @@ bool VariationsHttpHeaderProvider::SetDefaultVariationIds(
VariationsHttpHeaderProvider::VariationsHttpHeaderProvider()
: variation_ids_cache_initialized_(false) {
+ content::ServiceWorkerContext::AddExcludedHeaderNameForFetchEvent(
Alexei Svitkine (slow) 2014/10/27 15:09:00 Since this code can't depend on content/ per my co
michaeln 2014/10/27 21:50:26 Sounds reasonable, maybe the ChromeResourceDispatc
horo 2014/10/28 02:35:05 Done.
+ kChromeUMAEnabled);
+ content::ServiceWorkerContext::AddExcludedHeaderNameForFetchEvent(
+ kClientData);
}
VariationsHttpHeaderProvider::~VariationsHttpHeaderProvider() {

Powered by Google App Engine
This is Rietveld 408576698