Chromium Code Reviews| Index: components/safe_browsing/base_ping_manager.cc |
| diff --git a/components/safe_browsing/base_ping_manager.cc b/components/safe_browsing/base_ping_manager.cc |
| index ed54971a028be7cff61ea957006193ee43231b1b..c7b8cb83a2edec2a46ce7db8e98191638578097c 100644 |
| --- a/components/safe_browsing/base_ping_manager.cc |
| +++ b/components/safe_browsing/base_ping_manager.cc |
| @@ -18,6 +18,7 @@ |
| #include "net/base/escape.h" |
| #include "net/base/load_flags.h" |
| #include "net/log/net_log_source_type.h" |
| +#include "net/traffic_annotation/network_traffic_annotation.h" |
| #include "net/url_request/url_fetcher.h" |
| #include "net/url_request/url_request_context.h" |
| #include "net/url_request/url_request_context_getter.h" |
| @@ -109,11 +110,32 @@ void BasePingManager::OnURLFetchComplete(const net::URLFetcher* source) { |
| void BasePingManager::ReportSafeBrowsingHit( |
| const safe_browsing::HitReport& hit_report) { |
| GURL report_url = SafeBrowsingHitUrl(hit_report); |
| + net::NetworkTrafficAnnotationTag traffic_annotation = |
| + net::DefineNetworkTrafficAnnotation("...", R"( |
| + semantics { |
| + sender: "..." |
|
Nathan Parker
2017/04/14 21:32:23
Sender: Safe browsing extended reporting
desc: Whe
Ramin Halavati
2017/04/18 08:46:40
Done.
|
| + description: "..." |
| + trigger: "..." |
| + data: "..." |
| + destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER |
| + } |
| + policy { |
| + cookies_allowed: false/true |
| + cookies_store: "..." |
| + setting: "..." |
| + chrome_policy { |
| + [POLICY_NAME] { |
| + policy_options {mode: MANDATORY/RECOMMENDED/UNSET} |
| + [POLICY_NAME]: ... //(value to disable it) |
| + } |
| + } |
| + policy_exception_justification: "..." |
| + })"); |
| std::unique_ptr<net::URLFetcher> report_ptr = net::URLFetcher::Create( |
| report_url, |
| hit_report.post_data.empty() ? net::URLFetcher::GET |
| : net::URLFetcher::POST, |
| - this); |
| + this, traffic_annotation); |
| net::URLFetcher* report = report_ptr.get(); |
| data_use_measurement::DataUseUserData::AttachToFetcher( |
| report, data_use_measurement::DataUseUserData::SAFE_BROWSING); |
| @@ -137,8 +159,29 @@ void BasePingManager::ReportSafeBrowsingHit( |
| // Sends threat details for users who opt-in. |
| void BasePingManager::ReportThreatDetails(const std::string& report) { |
| GURL report_url = ThreatDetailsUrl(); |
| - std::unique_ptr<net::URLFetcher> fetcher = |
| - net::URLFetcher::Create(report_url, net::URLFetcher::POST, this); |
| + net::NetworkTrafficAnnotationTag traffic_annotation = |
| + net::DefineNetworkTrafficAnnotation("...", R"( |
|
Nathan Parker
2017/04/14 21:32:23
Same as above. We'll eventually consolidate these
Ramin Halavati
2017/04/18 08:46:40
As they were the same, merged them into one consta
|
| + semantics { |
| + sender: "..." |
| + description: "..." |
| + trigger: "..." |
| + data: "..." |
| + destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER |
| + } |
| + policy { |
| + cookies_allowed: false/true |
| + cookies_store: "..." |
| + setting: "..." |
| + chrome_policy { |
| + [POLICY_NAME] { |
| + policy_options {mode: MANDATORY/RECOMMENDED/UNSET} |
| + [POLICY_NAME]: ... //(value to disable it) |
| + } |
| + } |
| + policy_exception_justification: "..." |
| + })"); |
| + std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create( |
| + report_url, net::URLFetcher::POST, this, traffic_annotation); |
| data_use_measurement::DataUseUserData::AttachToFetcher( |
| fetcher.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING); |
| fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE); |