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

Side by Side Diff: chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc

Issue 2682263002: Network traffic annotation added to chrome::BitmapFetcher. (Closed)
Patch Set: Comments addressed. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" 5 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/feature_list.h" 9 #include "base/feature_list.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/common/chrome_features.h" 27 #include "chrome/common/chrome_features.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "components/browser_sync/profile_sync_service.h" 30 #include "components/browser_sync/profile_sync_service.h"
31 #include "components/history/core/browser/history_service.h" 31 #include "components/history/core/browser/history_service.h"
32 #include "components/omnibox/browser/autocomplete_classifier.h" 32 #include "components/omnibox/browser/autocomplete_classifier.h"
33 #include "components/prefs/pref_service.h" 33 #include "components/prefs/pref_service.h"
34 #include "components/sync/driver/sync_service_utils.h" 34 #include "components/sync/driver/sync_service_utils.h"
35 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
36 #include "extensions/features/features.h" 36 #include "extensions/features/features.h"
37 #include "net/traffic_annotation/network_traffic_annotation.h"
37 38
38 #if BUILDFLAG(ENABLE_EXTENSIONS) 39 #if BUILDFLAG(ENABLE_EXTENSIONS)
39 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" 40 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h"
40 #endif 41 #endif
41 42
42 #if !defined(OS_ANDROID) 43 #if !defined(OS_ANDROID)
43 namespace { 44 namespace {
44 45
45 // This list should be kept in sync with chrome/common/url_constants.h. 46 // This list should be kept in sync with chrome/common/url_constants.h.
46 // Only include useful sub-pages, confirmation alerts are not useful. 47 // Only include useful sub-pages, confirmation alerts are not useful.
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 void ChromeAutocompleteProviderClient::DeleteMatchingURLsForKeywordFromHistory( 242 void ChromeAutocompleteProviderClient::DeleteMatchingURLsForKeywordFromHistory(
242 history::KeywordID keyword_id, 243 history::KeywordID keyword_id,
243 const base::string16& term) { 244 const base::string16& term) {
244 GetHistoryService()->DeleteMatchingURLsForKeyword(keyword_id, term); 245 GetHistoryService()->DeleteMatchingURLsForKeyword(keyword_id, term);
245 } 246 }
246 247
247 void ChromeAutocompleteProviderClient::PrefetchImage(const GURL& url) { 248 void ChromeAutocompleteProviderClient::PrefetchImage(const GURL& url) {
248 BitmapFetcherService* image_service = 249 BitmapFetcherService* image_service =
249 BitmapFetcherServiceFactory::GetForBrowserContext(profile_); 250 BitmapFetcherServiceFactory::GetForBrowserContext(profile_);
250 DCHECK(image_service); 251 DCHECK(image_service);
251 image_service->Prefetch(url); 252
253 // TODO(jdonnelly@, rhalavati@): Create a helper function with Callback to
Justin Donnelly 2017/02/16 14:53:18 I've never seen @ used in a TODO. Unless there was
Ramin Halavati 2017/02/17 06:30:12 Done.
254 // create annotation and pass it to image_service, merging this annotation and
255 // the one in "c/b/ui/omnibox/chrome_omnibox_client.cc".
256 net::NetworkTrafficAnnotationTag traffic_annotation =
257 net::DefineNetworkTrafficAnnotation("omnibox_prefetch_image", R"(
258 semantics {
259 sender: "Omnibox Suggest Prefetch"
260 description:
261 "Google Chrome provides answers in the suggestion list to the "
262 "queries you type in the omnibox. This request retrieves a "
263 "small image (for example, an icon illustrating the current "
264 "weather conditions) when this can add information to the "
265 "answer."
266 trigger:
267 "Change of results for the query typed by the user in the "
268 "omnibox."
269 data:
270 "The only data sent is the path to an image. No user data is "
271 "included, although the general weather condition (sunny, "
272 "rainy, etc.) in the user's current location could be inferred "
273 "from the name of the image in the path."
274 destination: WEBSITE
275 }
276 policy {
277 cookies_allowed: true
278 cookies_store: "user"
279 setting:
280 "You can enable or disable this feature via 'Use a prediction "
281 "service to help complete searches and URLs typed in the "
282 "address bar.' in Chrome's settings under Advanced. The "
283 "feature is enabled by default."
284 policy {
285 SearchSuggestEnabled {
286 policy_options {mode: MANDATORY}
287 value: false
288 }
289 }
290 })");
291
292 image_service->Prefetch(url, traffic_annotation);
252 } 293 }
253 294
254 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( 295 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady(
255 AutocompleteController* controller) { 296 AutocompleteController* controller) {
256 content::NotificationService::current()->Notify( 297 content::NotificationService::current()->Notify(
257 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, 298 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY,
258 content::Source<AutocompleteController>(controller), 299 content::Source<AutocompleteController>(controller),
259 content::NotificationService::NoDetails()); 300 content::NotificationService::NoDetails());
260 } 301 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bitmap_fetcher/bitmap_fetcher.h » ('j') | chrome/browser/extensions/webstore_install_helper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698