 Chromium Code Reviews
 Chromium Code Reviews Issue 2682263002:
  Network traffic annotation added to chrome::BitmapFetcher.  (Closed)
    
  
    Issue 2682263002:
  Network traffic annotation added to chrome::BitmapFetcher.  (Closed) 
  | Index: chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc | 
| diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc | 
| index 12d6b2f1c50ade6f3d7ab02dd611ca7995ebf8eb..d643c2e3c7f9efe727ce782c447e757cbb82aaab 100644 | 
| --- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc | 
| +++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc | 
| @@ -34,6 +34,7 @@ | 
| #include "components/sync/driver/sync_service_utils.h" | 
| #include "content/public/browser/notification_service.h" | 
| #include "extensions/features/features.h" | 
| +#include "net/traffic_annotation/network_traffic_annotation.h" | 
| #if BUILDFLAG(ENABLE_EXTENSIONS) | 
| #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" | 
| @@ -248,7 +249,47 @@ void ChromeAutocompleteProviderClient::PrefetchImage(const GURL& url) { | 
| BitmapFetcherService* image_service = | 
| BitmapFetcherServiceFactory::GetForBrowserContext(profile_); | 
| DCHECK(image_service); | 
| - image_service->Prefetch(url); | 
| + | 
| + // TODO(jdonnelly, rhalavati): Create a helper function with Callback to | 
| + // create annotation and pass it to image_service, merging this annotation and | 
| + // the one in "c/b/ui/omnibox/chrome_omnibox_client.cc". | 
| 
Peter Kasting
2017/02/17 07:11:48
Nit: Remove quotes and spell out the full pathname
 
Ramin Halavati
2017/02/17 08:09:21
Done.
 | 
| + net::NetworkTrafficAnnotationTag traffic_annotation = | 
| + net::DefineNetworkTrafficAnnotation("omnibox_prefetch_image", R"( | 
| + semantics { | 
| + sender: "Omnibox Suggest Prefetch" | 
| + description: | 
| + "Google Chrome provides answers in the suggestion list to the " | 
| 
Peter Kasting
2017/02/17 07:11:48
Nit: to the -> for certain
 
Ramin Halavati
2017/02/17 08:09:22
Done.
 | 
| + "queries you type in the omnibox. This request retrieves a " | 
| + "small image (for example, an icon illustrating the current " | 
| + "weather conditions) when this can add information to the " | 
| 
Peter Kasting
2017/02/17 07:11:48
Nit: the -> an
 
Ramin Halavati
2017/02/17 08:09:22
Done.
 | 
| + "answer." | 
| + trigger: | 
| + "Change of results for the query typed by the user in the " | 
| + "omnibox." | 
| + data: | 
| + "The only data sent is the path to an image. No user data is " | 
| + "included, although the general weather condition (sunny, " | 
| 
Peter Kasting
2017/02/17 07:11:48
Nit: "...although some might be inferrable (e.g. w
 
Ramin Halavati
2017/02/17 08:09:21
Done, I think it's a clarifying example.
 
Justin Donnelly
2017/02/21 16:10:03
Sorry, I missed this discussion earlier. Peter: to
 | 
| + "rainy, etc.) in the user's current location could be inferred " | 
| + "from the name of the image in the path." | 
| + destination: WEBSITE | 
| + } | 
| + policy { | 
| + cookies_allowed: true | 
| + cookies_store: "user" | 
| + setting: | 
| + "You can enable or disable this feature via 'Use a prediction " | 
| + "service to help complete searches and URLs typed in the " | 
| + "address bar.' in Chrome's settings under Advanced. The " | 
| + "feature is enabled by default." | 
| + policy { | 
| + SearchSuggestEnabled { | 
| + policy_options {mode: MANDATORY} | 
| + value: false | 
| + } | 
| + } | 
| + })"); | 
| + | 
| + image_service->Prefetch(url, traffic_annotation); | 
| } | 
| void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( |