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

Unified Diff: chrome/browser/safe_browsing/two_phase_uploader.cc

Issue 2697193003: Network traffic annotation added to safe_browsing (Closed)
Patch Set: 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
Index: chrome/browser/safe_browsing/two_phase_uploader.cc
diff --git a/chrome/browser/safe_browsing/two_phase_uploader.cc b/chrome/browser/safe_browsing/two_phase_uploader.cc
index 07e71bbe7c40080e28a909684c5ab7289749a1d7..ee3d343b15a65544652a989d730b12d22ba1d4ae 100644
--- a/chrome/browser/safe_browsing/two_phase_uploader.cc
+++ b/chrome/browser/safe_browsing/two_phase_uploader.cc
@@ -16,6 +16,7 @@
#include "content/public/browser/browser_thread.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_status.h"
@@ -168,8 +169,32 @@ void TwoPhaseUploaderImpl::OnURLFetchUploadProgress(
void TwoPhaseUploaderImpl::UploadMetadata() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
state_ = UPLOAD_METADATA;
- url_fetcher_ =
- net::URLFetcher::Create(base_url_, net::URLFetcher::POST, this);
+
+ // Create traffic annotation tag.
mattm 2017/02/18 02:23:45 Although TwoPhaseUploader is only used in one plac
Ramin Halavati 2017/02/20 09:08:35 Done.
+ net::NetworkTrafficAnnotationTag traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("...", R"(
Nathan Parker 2017/02/18 22:16:55 Is there a doc describing the intention of these f
Ramin Halavati 2017/02/20 09:08:35 Yes, there are references on the first email on th
+ semantics {
+ sender: "..."
+ description: "..."
+ trigger: "..."
+ data: "..."
+ destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
+ }
+ policy {
+ cookies_allowed: false/true
+ cookies_store: "..."
+ setting: "..."
+ policy {
+ [POLICY_NAME] {
+ policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
+ value: ...
+ }
+ }
+ policy_exception_justification: "..."
+ })");
+
+ url_fetcher_ = net::URLFetcher::Create(base_url_, net::URLFetcher::POST, this,
+ traffic_annotation);
data_use_measurement::DataUseUserData::AttachToFetcher(
url_fetcher_.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING);
url_fetcher_->SetRequestContext(url_request_context_getter_.get());
@@ -182,8 +207,31 @@ void TwoPhaseUploaderImpl::UploadFile() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
state_ = UPLOAD_FILE;
- url_fetcher_ =
- net::URLFetcher::Create(upload_url_, net::URLFetcher::PUT, this);
+ // Create traffic annotation tag.
+ net::NetworkTrafficAnnotationTag traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("...", R"(
+ semantics {
+ sender: "..."
+ description: "..."
+ trigger: "..."
+ data: "..."
+ destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
+ }
+ policy {
+ cookies_allowed: false/true
+ cookies_store: "..."
+ setting: "..."
+ policy {
+ [POLICY_NAME] {
+ policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
+ value: ...
+ }
+ }
+ policy_exception_justification: "..."
+ })");
+
+ url_fetcher_ = net::URLFetcher::Create(upload_url_, net::URLFetcher::PUT,
+ this, traffic_annotation);
data_use_measurement::DataUseUserData::AttachToFetcher(
url_fetcher_.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING);
url_fetcher_->SetRequestContext(url_request_context_getter_.get());

Powered by Google App Engine
This is Rietveld 408576698