Chromium Code Reviews| Index: chrome/browser/ui/omnibox/chrome_omnibox_client.cc |
| diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_client.cc b/chrome/browser/ui/omnibox/chrome_omnibox_client.cc |
| index 3e12199b9ce6e01a39cd809637a45215c28636ef..7672da65ecf1b5b2dbd577c03a111fad9c25572d 100644 |
| --- a/chrome/browser/ui/omnibox/chrome_omnibox_client.cc |
| +++ b/chrome/browser/ui/omnibox/chrome_omnibox_client.cc |
| @@ -48,6 +48,7 @@ |
| #include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/web_contents.h" |
| #include "extensions/common/constants.h" |
| +#include "net/traffic_annotation/network_traffic_annotation.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| #include "ui/base/window_open_disposition.h" |
| #include "url/gurl.h" |
| @@ -289,11 +290,53 @@ void ChromeOmniboxClient::OnResultChanged( |
| BitmapFetcherServiceFactory::GetForBrowserContext(profile_); |
| if (image_service) { |
| image_service->CancelRequest(request_id_); |
| + |
| + // 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 |
| + // chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc |
| + net::NetworkTrafficAnnotationTag traffic_annotation = |
| + net::DefineNetworkTrafficAnnotation("omnibox_result_change", R"( |
| + semantics { |
| + sender: "Omnibox Suggest" |
|
Ramin Halavati
2017/02/24 08:05:51
Should this be changed to Omnibox?
battre
2017/02/24 08:09:21
Yes, I think that would be reasonable.
Ramin Halavati
2017/02/24 08:22:56
Done.
|
| + description: |
| + "Google Chrome provides answers in the suggestion list for " |
| + "certain queries that user types in the omnibox. This request " |
| + "retrieves a small image (for example, an icon illustrating " |
| + "the current weather conditions) when this can add information " |
| + "to an 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 some might be inferrable (e.g. whether the " |
| + "weather is sunny or rainy in the user's current location) " |
| + "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 |
| + } |
| + } |
| + })"); |
| + |
| request_id_ = image_service->RequestImage( |
| match->answer->second_line().image_url(), |
| new AnswerImageObserver( |
| base::Bind(&ChromeOmniboxClient::OnBitmapFetched, |
| - base::Unretained(this), on_bitmap_fetched))); |
| + base::Unretained(this), on_bitmap_fetched)), |
| + traffic_annotation); |
| } |
| } |
| } |