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

Unified Diff: components/spellcheck/browser/spelling_service_client.cc

Issue 2421333002: Protobuf for Traffic Annotation and first use by a URLFetcher. (Closed)
Patch Set: Created 4 years, 2 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: components/spellcheck/browser/spelling_service_client.cc
diff --git a/components/spellcheck/browser/spelling_service_client.cc b/components/spellcheck/browser/spelling_service_client.cc
index 44c51ccb695ffd6c1e79d254b933475423a8853e..a621fa248bf0f708bb122501a047ba51c34f3d57 100644
--- a/components/spellcheck/browser/spelling_service_client.cc
+++ b/components/spellcheck/browser/spelling_service_client.cc
@@ -102,7 +102,31 @@ bool SpellingServiceClient::RequestTextCheck(
country_code.c_str(), api_key.c_str());
GURL url = GURL(kSpellingServiceURL);
- net::URLFetcher* fetcher = CreateURLFetcher(url).release();
+
+ // Create traffic annotation tag.
+ net::NetworkTrafficAnnotationTag traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("spellcheck_lookup", R"(
+ semantics {
+ sender: "spellcheck"
+ description: "Sends the text a user types into a text field in the "
+ "content area of the browser. Also sends a misspelled "
+ "word, if a user right-clicks on it."
battre 2016/10/17 14:58:45 Looking at this again, I think that we need to des
Ramin Halavati 2016/10/18 06:57:56 Done.
+ trigger: "User types something or asks to correct a misspelled word."
battre 2016/10/17 14:58:45 trigger: User types text into a text field or asks
Ramin Halavati 2016/10/18 06:57:56 Done.
+ data: "Text a user has typed into a text field. No user identifier "
+ "is sent along with the text."
+ destination: GOOGLE_OWNED_SERVICE
+ }
+ policy {
+ cookies_allowed: false
+ setting: "You can disable 'Use a web service to help resolve "
+ "spelling errors.' in Chrome's settings under Advanced."
battre 2016/10/17 14:58:45 You can enable or disable this feature via '...' .
Ramin Halavati 2016/10/18 06:57:56 Done.
+ policy: "SpellCheckServiceEnabled: "
battre 2016/10/17 14:58:45 nit: no space after colon
Ramin Halavati 2016/10/18 06:57:56 Done.
+ " policy_options: MANDATORY"
+ " value: false"
+ })");
+
+ net::URLFetcher* fetcher =
+ CreateURLFetcher(url, traffic_annotation).release();
data_use_measurement::DataUseUserData::AttachToFetcher(
fetcher, data_use_measurement::DataUseUserData::SPELL_CHECKER);
fetcher->SetRequestContext(
@@ -269,6 +293,8 @@ void SpellingServiceClient::OnURLFetchComplete(const net::URLFetcher* source) {
}
std::unique_ptr<net::URLFetcher> SpellingServiceClient::CreateURLFetcher(
- const GURL& url) {
- return net::URLFetcher::Create(url, net::URLFetcher::POST, this);
+ const GURL& url,
+ net::NetworkTrafficAnnotationTag traffic_annotation) {
+ return net::URLFetcher::Create(url, net::URLFetcher::POST, this,
+ traffic_annotation);
}

Powered by Google App Engine
This is Rietveld 408576698