Chromium Code Reviews| 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..4b3d60d41bba1c6cffc4926625f33d585e8266bb 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,49 @@ 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 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 starts, it downloads the list of supported " |
| + "langagues for translation, and a predictive model to detect the " |
| + "language of web pages. The model is cached and the link to the " |
| + "latest model is provided by finch. If latest model is already " |
|
Takashi Toyoshima
2017/04/18 07:00:08
Probably, we should not use the word 'finch' outsi
Ramin Halavati
2017/04/18 07:08:14
Done.
|
| + "cached, it is not fetched. The first time the model decides to " |
| + "offer translation of a web site, it triggers a popup to ask if " |
| + "user wants a translation and if user approves, translation " |
| + "library is downloaded. The library is cached for a day and is not " |
| + "fetched if it is available and fresh." |
| + data: |
| + "Current local is sent to fetch the list of supperted lanaguges. " |
|
Takashi Toyoshima
2017/04/18 07:00:08
s/local/locale/
Ramin Halavati
2017/04/18 07:08:14
Done.
|
| + "Translation library 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." |
|
Takashi Toyoshima
2017/04/18 07:00:08
Sorry for changing explanations, but could you als
Ramin Halavati
2017/04/18 07:08:14
Done, thanks for being very precise about it.
|
| + chrome_policy { |
| + TranslateEnabled { |
| + policy_options {mode: MANDATORY} |
| + TranslateEnabled: false |
| + } |
| + } |
|
Takashi Toyoshima
2017/04/18 07:00:08
shall we have the policy_exception_justification e
Ramin Halavati
2017/04/18 07:08:14
Done, I have added it, we will make a decision in
|
| + })"); |
| + 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 | |