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

Unified Diff: components/metrics/net/net_metrics_log_uploader.cc

Issue 2703363002: Network traffic annotation added to NetMetricsLogUploader. (Closed)
Patch Set: nits Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c39a5c162589c98c06a2f149c275b5a66ce6b3da 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,89 @@ 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;
switch (service_type_) {
case MetricsLogUploader::UMA:
service = data_use_measurement::DataUseUserData::UMA;
+ traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("metrics_report_uma", R"(
+ semantics {
+ sender: "Metrics 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'."
+ 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 Log Uploader"
rkaplow 2017/03/02 00:18:28 you mention it doesn't need to be unique, but seem
Ramin Halavati 2017/03/02 06:13:16 Done.
+ description:
+ "Report of usage statistics and crash-related data about "
rkaplow 2017/03/02 00:18:28 Report of usage statistics that are keyed by URLs
+ "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'."
+ trigger:
+ "Reports are automatically generated on startup and at "
+ "intervals while Chromium is running."
rkaplow 2017/03/02 00:18:28 ... running with Sync enabled.
Ramin Halavati 2017/03/02 06:13:17 Done.
+ data:
+ "A protocol buffer with usage statistics and crash related "
rkaplow 2017/03/02 00:18:28 "A protocol buffer with usage statistics and assoc
Ramin Halavati 2017/03/02 06:13:17 Done.
+ "data."
+ destination: GOOGLE_OWNED_SERVICE
+ }
+ policy {
+ cookies_allowed: false
+ setting:
+ "Users can enable or disable this feature by disabling "
rkaplow 2017/03/02 00:18:28 Users can enable or disable this feature by disabl
Ramin Halavati 2017/03/02 06:13:16 Done.
+ "'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;
}
+ 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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698