OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 net::NetworkTrafficAnnotationTag traffic_annotation = |
253 net::DefineNetworkTrafficAnnotation("", R"( | |
254 semantics { | |
255 sender: "" | |
Justin Donnelly
2017/02/14 17:01:05
As pkasting points out, these should be identical
Ramin Halavati
2017/02/15 11:52:02
To keep the clang tool that extracts annotation si
Justin Donnelly
2017/02/15 21:39:44
That seems reasonable. But if we're going to intro
Peter Kasting
2017/02/16 00:05:21
If the tools can handle the following proposal, it
Ramin Halavati
2017/02/16 07:03:30
The Callback solution seems good. If you agree, I
| |
256 description: "" | |
257 trigger: "" | |
258 data: "" | |
259 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER | |
260 } | |
261 policy { | |
262 cookies_allowed: false/true | |
263 cookies_store: "" | |
264 setting: "" | |
265 policy { | |
266 [POLICY_NAME] { | |
267 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
268 value: ... | |
269 } | |
270 } | |
271 })"); | |
272 image_service->Prefetch(url, traffic_annotation); | |
252 } | 273 } |
253 | 274 |
254 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( | 275 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( |
255 AutocompleteController* controller) { | 276 AutocompleteController* controller) { |
256 content::NotificationService::current()->Notify( | 277 content::NotificationService::current()->Notify( |
257 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 278 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
258 content::Source<AutocompleteController>(controller), | 279 content::Source<AutocompleteController>(controller), |
259 content::NotificationService::NoDetails()); | 280 content::NotificationService::NoDetails()); |
260 } | 281 } |
OLD | NEW |