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

Unified Diff: content/browser/appcache/appcache_update_job.cc

Issue 2799133005: Network traffic annotation added to appcache_update_job. (Closed)
Patch Set: Header added. Created 3 years, 8 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: content/browser/appcache/appcache_update_job.cc
diff --git a/content/browser/appcache/appcache_update_job.cc b/content/browser/appcache/appcache_update_job.cc
index e55f991e5f987d2be0d2f172513ca10772d5b200..0bc8b0c1a3a3bde262667de11c1f7cb2c81a81f7 100644
--- a/content/browser/appcache/appcache_update_job.cc
+++ b/content/browser/appcache/appcache_update_job.cc
@@ -21,6 +21,7 @@
#include "net/base/request_priority.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/url_request_context.h"
#include "url/origin.h"
@@ -69,6 +70,27 @@ bool IsEvictableError(AppCacheUpdateJob::ResultType result,
void EmptyCompletionCallback(int result) {}
+constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =
michaeln 2017/04/07 20:36:59 "In case you believe that annotation should be pas
Ramin Halavati 2017/04/10 05:50:31 Sometimes, based on the inputs to the function tha
+ net::DefineNetworkTrafficAnnotation("...", R"(
+ semantics {
+ sender: "..."
+ description: "..."
+ trigger: "..."
+ data: "..."
+ destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL
+ }
+ 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: "..."
+ })");
michaeln 2017/04/20 20:22:00 constexpr net::NetworkTrafficAnnotationTag kTraffi
Ramin Halavati 2017/04/21 05:41:14 Done.
} // namespace
// Helper class for collecting hosts per frontend when sending notifications
@@ -158,8 +180,11 @@ AppCacheUpdateJob::URLFetcher::URLFetcher(const GURL& url,
fetch_type_(fetch_type),
retry_503_attempts_(0),
buffer_(new net::IOBuffer(kBufferSize)),
- request_(job->service_->request_context()
- ->CreateRequest(url, net::DEFAULT_PRIORITY, this)),
+ request_(
+ job->service_->request_context()->CreateRequest(url,
+ net::DEFAULT_PRIORITY,
+ this,
+ kTrafficAnnotation)),
result_(UPDATE_OK),
redirect_response_code_(-1) {}
@@ -392,8 +417,29 @@ bool AppCacheUpdateJob::URLFetcher::MaybeRetryRequest() {
}
++retry_503_attempts_;
result_ = UPDATE_OK;
+ net::NetworkTrafficAnnotationTag traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("...", R"(
+ semantics {
+ sender: "..."
+ description: "..."
+ trigger: "..."
+ data: "..."
+ destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL
+ }
+ 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: "..."
+ })");
request_ = job_->service_->request_context()->CreateRequest(
- url_, net::DEFAULT_PRIORITY, this);
+ url_, net::DEFAULT_PRIORITY, this, traffic_annotation);
michaeln 2017/04/07 20:36:59 Why not use kTrafficAnnotation here too? Do you wa
Ramin Halavati 2017/04/10 05:50:31 If both network requests can be described with one
michaeln 2017/04/20 20:22:00 Both can be described with the same annotation.
Ramin Halavati 2017/04/21 05:41:14 Done.
Start();
return true;
}

Powered by Google App Engine
This is Rietveld 408576698