Index: components/metrics/net/net_metrics_log_uploader.cc |
diff --git a/components/metrics/net/net_metrics_log_uploader.cc b/components/metrics/net/net_metrics_log_uploader.cc |
index 0064177a58c8991cec99004971d86c6df20d1231..03ca7e9287ee857d40e7cf593133fa4834e88b37 100644 |
--- a/components/metrics/net/net_metrics_log_uploader.cc |
+++ b/components/metrics/net/net_metrics_log_uploader.cc |
@@ -8,6 +8,7 @@ |
#include "components/data_use_measurement/core/data_use_user_data.h" |
#include "components/metrics/metrics_log_uploader.h" |
#include "net/base/load_flags.h" |
+#include "net/traffic_annotation/network_traffic_annotation.h" |
#include "net/url_request/url_fetcher.h" |
#include "url/gurl.h" |
@@ -30,21 +31,93 @@ NetMetricsLogUploader::~NetMetricsLogUploader() { |
void NetMetricsLogUploader::UploadLog(const std::string& compressed_log_data, |
const std::string& log_hash) { |
- current_fetch_ = |
- net::URLFetcher::Create(GURL(server_url_), net::URLFetcher::POST, this); |
- |
auto service = data_use_measurement::DataUseUserData::UMA; |
- |
+ net::NetworkTrafficAnnotationTag traffic_annotation = |
+ NO_TRAFFIC_ANNOTATION_YET; |
battre
2017/03/08 14:19:31
I think that this is problematic because it will k
Ramin Halavati
2017/03/08 15:04:10
You are right, moved it to anonymous function.
|
switch (service_type_) { |
case MetricsLogUploader::UMA: |
service = data_use_measurement::DataUseUserData::UMA; |
+ traffic_annotation = |
+ net::DefineNetworkTrafficAnnotation("metrics_report_uma", R"( |
+ semantics { |
+ sender: "Metrics UMA Log Uploader" |
+ description: |
+ "Report of usage statistics and crash-related data about " |
+ "Chromium. Usage statistics contain information such as " |
+ "preferences, button clicks, and memory usage and do not " |
+ "include web page URLs or personal information. See more at " |
+ "https://www.google.com/chrome/browser/privacy/ under 'Usage " |
+ "statistics and crash reports'." |
battre
2017/03/08 14:19:31
Add at the end: Usage statistics are tied to a pse
Ramin Halavati
2017/03/08 15:04:10
Done.
|
+ trigger: |
+ "Reports are automatically generated on startup and at " |
+ "intervals while Chromium is running." |
+ data: |
+ "A protocol buffer with usage statistics and crash related " |
+ "data." |
+ destination: GOOGLE_OWNED_SERVICE |
+ } |
+ policy { |
+ cookies_allowed: false |
+ setting: |
+ "Users can enable or disable this feature by disabling " |
+ "'Automatically send usage statistics and crash reports to " |
+ "Google' in Chromium's settings under Advanced Settings, " |
+ "Privacy. The feature is enabled by default." |
+ policy { |
+ MetricsReportingEnabled { |
+ policy_options {mode: MANDATORY} |
+ value: false |
+ } |
+ } |
+ })"); |
break; |
case MetricsLogUploader::UKM: |
service = data_use_measurement::DataUseUserData::UKM; |
+ traffic_annotation = |
+ net::DefineNetworkTrafficAnnotation("metrics_report_ukm", R"( |
+ semantics { |
+ sender: "Metrics UKM Log Uploader" |
+ description: |
+ "Report of usage statistics that are keyed by URLs to " |
+ "Chromium, sent only if the profile has History Sync. This " |
+ "includes information about the web pages you visit and your " |
+ "usage of them, such as page load speed. This will also " |
+ "include URLs and statistics related to downloaded files. If " |
+ "Extension Sync is enabled, these statistics will also include " |
+ "information about the extensions that have been installed " |
+ "from Chrome Web Store. Google only stores usage statistics " |
+ "associated with published extensions, and URLs that are known " |
+ "by Google’s search index." |
battre
2017/03/08 14:19:31
Add at the end: Add: Usage statistics are tied to
Ramin Halavati
2017/03/08 15:04:10
Done.
|
+ trigger: |
+ "Reports are automatically generated on startup and at " |
+ "intervals while Chromium is running with Sync enabled." |
+ data: |
+ "A protocol buffer with usage statistics and associated URLs." |
+ destination: GOOGLE_OWNED_SERVICE |
+ } |
+ policy { |
+ cookies_allowed: false |
+ setting: |
+ "Users can enable or disable this feature by disabling " |
+ "'Automatically send usage statistics and crash reports to " |
+ "Google' in Chromium's settings under Advanced Settings, " |
+ "Privacy. This is only enabled if all active profiles have " |
+ "History/Extension Sync enabled without a Sync passphrase." |
+ policy { |
+ MetricsReportingEnabled { |
+ policy_options {mode: MANDATORY} |
+ value: false |
+ } |
+ } |
+ })"); |
break; |
} |
+ current_fetch_ = net::URLFetcher::Create( |
+ GURL(server_url_), net::URLFetcher::POST, this, traffic_annotation); |
+ |
data_use_measurement::DataUseUserData::AttachToFetcher(current_fetch_.get(), |
service); |
+ |
current_fetch_->SetRequestContext(request_context_getter_); |
current_fetch_->SetUploadData(mime_type_, compressed_log_data); |