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

Unified Diff: components/translate/core/browser/translate_url_fetcher.cc

Issue 2796323002: Network traffic annotation added to translate_url_fetcher. (Closed)
Patch Set: Annotation updated. 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/translate/core/browser/translate_url_fetcher.cc
diff --git a/components/translate/core/browser/translate_url_fetcher.cc b/components/translate/core/browser/translate_url_fetcher.cc
index dbbff3176056f9c9c199a3e1e7c84e4503213316..729f3041e288cb9ff52909c2b624f4eff6db6543 100644
--- a/components/translate/core/browser/translate_url_fetcher.cc
+++ b/components/translate/core/browser/translate_url_fetcher.cc
@@ -8,6 +8,7 @@
#include "components/translate/core/browser/translate_download_manager.h"
#include "net/base/load_flags.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_status.h"
@@ -46,7 +47,44 @@ bool TranslateURLFetcher::Request(
url_ = url;
callback_ = callback;
- fetcher_ = net::URLFetcher::Create(id_, url_, net::URLFetcher::GET, this);
+ net::NetworkTrafficAnnotationTag traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("translate_url_fetcher", R"(
+ semantics {
+ sender: "Translate"
+ description:
+ "Chromium can provide translations for the web sites visited by "
+ "the user. If this feature is enabled, Chromium sends network "
+ "requests on startup to download the list of supported languages, "
+ "a library to perform translations, and a predictive model to know "
+ "when to offer translation."
+ trigger:
+ "When Chromium translates a web site, it triggers a request to "
Roger McFarlane (Chromium) 2017/04/11 14:04:19 I'm not sure what level of detail/precision is req
Takashi Toyoshima 2017/04/12 05:49:18 Do you think the predictive model downloading can
Ramin Halavati 2017/04/12 05:54:43 Done.
Ramin Halavati 2017/04/12 05:54:44 Acknowledged.
Roger McFarlane (Chromium) 2017/04/12 14:04:12 That's a good idea. But currently no, the download
+ "fetch the supporting language list in the first translation, and "
+ "will trigger another request to fetch the library once a day to "
+ "make sure it is up to date."
+ data:
+ "Language id of the library that is required. Translation library "
Takashi Toyoshima 2017/04/11 10:00:06 Precisely said, Chrome send the current locale on
Ramin Halavati 2017/04/12 05:54:43 Done.
+ "that is obtained via this interface would perform actual "
+ "translation, and it will send words and phrases in the site to "
+ "the server to translate it, but this request doesn't send any "
+ "words."
+ destination: GOOGLE_OWNED_SERVICE
+ }
+ policy {
+ cookies_allowed: false
+ setting:
+ "Users can enable/disable this feature by toggling 'Offer to "
+ "translate pages that aren't in a language you read.' in Chromium "
+ "settings under Languages."
+ chrome_policy {
+ TranslateEnabled {
+ policy_options {mode: MANDATORY}
+ TranslateEnabled: false
+ }
+ }
+ })");
+ fetcher_ = net::URLFetcher::Create(id_, url_, net::URLFetcher::GET, this,
+ traffic_annotation);
data_use_measurement::DataUseUserData::AttachToFetcher(
fetcher_.get(), data_use_measurement::DataUseUserData::TRANSLATE);
fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698