Chromium Code Reviews| 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 ee1af76a6c9a63d3fc753aaf3856553f1f9199f8..2c6433bfeb8236a9644c9af83042af41922da49f 100644 |
| --- a/components/metrics/net/net_metrics_log_uploader.cc |
| +++ b/components/metrics/net/net_metrics_log_uploader.cc |
| @@ -8,9 +8,90 @@ |
| #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" |
| +namespace { |
| + |
| +net::NetworkTrafficAnnotationTag GetNetworkTrafficAnnotation( |
| + const metrics::MetricsLogUploader::MetricServiceType& service_type) { |
| + if (service_type == metrics::MetricsLogUploader::UMA) { |
|
Alexei Svitkine (slow)
2017/03/08 16:02:19
Please use a switch, so that if a new type is adde
Ramin Halavati
2017/03/08 17:48:07
If we add a switch, we again need NO_TRAFFIC_ANNOT
|
| + return 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'. Usage statistics are tied to a " |
| + "pseudonymous machine identifier and not to your email address." |
| + 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." |
| + chrome_policy { |
| + MetricsReportingEnabled { |
| + policy_options {mode: MANDATORY} |
| + MetricsReportingEnabled: false |
| + } |
| + } |
| + })"); |
| + } else { |
| + return 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. " |
| + "Usage statistics are tied to a pseudonymous machine identifier " |
| + "and not to your email address." |
| + 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." |
| + chrome_policy { |
| + MetricsReportingEnabled { |
| + policy_options {mode: MANDATORY} |
| + MetricsReportingEnabled: false |
| + } |
| + } |
| + })"); |
| + } |
| +} |
| + |
| +} // namespace |
| + |
| namespace metrics { |
| NetMetricsLogUploader::NetMetricsLogUploader( |
| @@ -31,7 +112,8 @@ 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::URLFetcher::Create(GURL(server_url_), net::URLFetcher::POST, this, |
| + GetNetworkTrafficAnnotation(service_type_)); |
| auto service = data_use_measurement::DataUseUserData::UMA; |