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..c229f59e869241faabc0ec8a97cab07fb4d8bc75 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,43 @@ 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 translation of web sites that user visits " |
| + "through Google Translate service. If the feature is enabled, " |
| + "Chromium makes a network request to Google Translate service to " |
| + "know supporting languages, and to fetch a library to perform " |
| + "translations." |
| + trigger: |
| + "When Chromium translates a web site, it triggers a request to " |
| + "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: |
| + "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 requests that " |
| + "TranslateURLFetcher makes should not send anything." |
|
Ramin Halavati
2017/04/10 13:28:26
So my understanding is that this network request j
Takashi Toyoshima
2017/04/11 06:39:26
Yes, right.
That library is written in JavaScript
Ramin Halavati
2017/04/11 06:57:29
Done.
|
| + 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 | |