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..ad262dc21bb40ed4354bc2e5613abd8bffea2099 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,8 +31,40 @@ 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); |
+ net::NetworkTrafficAnnotationTag traffic_annotation = |
+ net::DefineNetworkTrafficAnnotation("metrics_report", R"( |
Alexei Svitkine (slow)
2017/02/27 15:42:56
This is only correct for the MetricsLogUploader::U
Ramin Halavati
2017/02/27 18:17:23
I separate the two cases.
|
+ semantics { |
+ sender: "Metrics Log Uploader" |
+ description: |
+ "Report of usage statistics and crash-related data about Google " |
+ "Chrome. 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'." |
+ trigger: |
+ "Reports are automatically generated on startup and at intervals " |
+ "while Chrome 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 Chrome's settings under Advanced Settings, Privacy. The " |
+ "feature is enabled by default." |
+ policy { |
+ MetricsReportingEnabled { |
+ policy_options {mode: MANDATORY} |
+ value: false |
+ } |
+ } |
+ })"); |
+ current_fetch_ = net::URLFetcher::Create( |
+ GURL(server_url_), net::URLFetcher::POST, this, traffic_annotation); |
auto service = data_use_measurement::DataUseUserData::UMA; |
@@ -45,6 +78,7 @@ void NetMetricsLogUploader::UploadLog(const std::string& compressed_log_data, |
} |
data_use_measurement::DataUseUserData::AttachToFetcher(current_fetch_.get(), |
service); |
+ |
current_fetch_->SetRequestContext(request_context_getter_); |
current_fetch_->SetUploadData(mime_type_, compressed_log_data); |