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

Unified Diff: components/ntp_snippets/remote/json_request.cc

Issue 2709483006: Network traffic annotation added to ntp_snippets. (Closed)
Patch Set: DEPS corrected. 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 | « components/ntp_snippets/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/remote/json_request.cc
diff --git a/components/ntp_snippets/remote/json_request.cc b/components/ntp_snippets/remote/json_request.cc
index dce963f1ca6ffa549906977ae53678b800eff0c4..c561553c985a97bfef762902874abd5e2f4dcb30 100644
--- a/components/ntp_snippets/remote/json_request.cc
+++ b/components/ntp_snippets/remote/json_request.cc
@@ -30,6 +30,7 @@
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
#include "third_party/icu/source/common/unicode/uloc.h"
@@ -431,8 +432,37 @@ std::unique_ptr<net::URLFetcher> JsonRequest::Builder::BuildURLFetcher(
net::URLFetcherDelegate* delegate,
const std::string& headers,
const std::string& body) const {
- std::unique_ptr<net::URLFetcher> url_fetcher =
- net::URLFetcher::Create(url_, net::URLFetcher::POST, delegate);
+ net::NetworkTrafficAnnotationTag traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("ntp_snippets_fetch", R"(
+ semantics {
+ sender: "New Tab Page Content Suggestions Fetch"
+ description:
+ "Chromium can show content suggestions (e.g. news articles) on the "
+ "New Tab page. For signed-in users, these may be personalized "
+ "based on the user's synced browsing history."
+ trigger:
+ "Triggered periodically in the background, or upon explicit user "
+ "request."
+ data:
+ "The Chromium UI language, as well as a second language the user "
+ "understands, based on translate::LanguageModel. For signed-in "
+ "users, the requests is authenticated."
+ destination: GOOGLE_OWNED_SERVICE
+ }
+ policy {
+ cookies_allowed: false
+ setting:
+ "This feature cannot be disabled by settings now (but is requested "
+ "to be implemented in crbug.com/695129)."
+ policy {
+ NTPContentSuggestionsEnabled {
+ policy_options {mode: MANDATORY}
+ value: false
+ }
+ }
+ })");
+ std::unique_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create(
+ url_, net::URLFetcher::POST, delegate, traffic_annotation);
url_fetcher->SetRequestContext(url_request_context_getter_.get());
url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
net::LOAD_DO_NOT_SAVE_COOKIES);
« no previous file with comments | « components/ntp_snippets/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698