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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 13 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 14 #include "chrome/browser/autocomplete/contextual_suggestions_service_factory.h" |
14 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" | 15 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" |
15 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" | 16 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
16 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" | 17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" |
17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" | 18 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" |
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
21 #include "chrome/browser/history/history_service_factory.h" | 22 #include "chrome/browser/history/history_service_factory.h" |
22 #include "chrome/browser/history/top_sites_factory.h" | 23 #include "chrome/browser/history/top_sites_factory.h" |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/search_engines/template_url_service_factory.h" | 25 #include "chrome/browser/search_engines/template_url_service_factory.h" |
25 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
27 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
28 #include "components/browser_sync/profile_sync_service.h" | 29 #include "components/browser_sync/profile_sync_service.h" |
| 30 #include "components/contextual_suggestions/contextual_suggestions_service.h" |
29 #include "components/history/core/browser/history_service.h" | 31 #include "components/history/core/browser/history_service.h" |
30 #include "components/omnibox/browser/autocomplete_classifier.h" | 32 #include "components/omnibox/browser/autocomplete_classifier.h" |
31 #include "components/prefs/pref_service.h" | 33 #include "components/prefs/pref_service.h" |
32 #include "components/sync/driver/sync_service_utils.h" | 34 #include "components/sync/driver/sync_service_utils.h" |
33 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
34 #include "extensions/features/features.h" | 36 #include "extensions/features/features.h" |
35 #include "net/traffic_annotation/network_traffic_annotation.h" | 37 #include "net/traffic_annotation/network_traffic_annotation.h" |
36 | 38 |
37 #if BUILDFLAG(ENABLE_EXTENSIONS) | 39 #if BUILDFLAG(ENABLE_EXTENSIONS) |
38 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" | 40 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 121 |
120 TemplateURLService* ChromeAutocompleteProviderClient::GetTemplateURLService() { | 122 TemplateURLService* ChromeAutocompleteProviderClient::GetTemplateURLService() { |
121 return TemplateURLServiceFactory::GetForProfile(profile_); | 123 return TemplateURLServiceFactory::GetForProfile(profile_); |
122 } | 124 } |
123 | 125 |
124 const TemplateURLService* | 126 const TemplateURLService* |
125 ChromeAutocompleteProviderClient::GetTemplateURLService() const { | 127 ChromeAutocompleteProviderClient::GetTemplateURLService() const { |
126 return TemplateURLServiceFactory::GetForProfile(profile_); | 128 return TemplateURLServiceFactory::GetForProfile(profile_); |
127 } | 129 } |
128 | 130 |
| 131 contextual_suggestions::ContextualSuggestionsService* |
| 132 ChromeAutocompleteProviderClient::GetContextualSuggestionsService() const { |
| 133 return contextual_suggestions::ContextualSuggestionsServiceFactory:: |
| 134 GetForProfile(profile_); |
| 135 } |
| 136 |
129 const | 137 const |
130 SearchTermsData& ChromeAutocompleteProviderClient::GetSearchTermsData() const { | 138 SearchTermsData& ChromeAutocompleteProviderClient::GetSearchTermsData() const { |
131 return search_terms_data_; | 139 return search_terms_data_; |
132 } | 140 } |
133 | 141 |
134 scoped_refptr<ShortcutsBackend> | 142 scoped_refptr<ShortcutsBackend> |
135 ChromeAutocompleteProviderClient::GetShortcutsBackend() { | 143 ChromeAutocompleteProviderClient::GetShortcutsBackend() { |
136 return ShortcutsBackendFactory::GetForProfile(profile_); | 144 return ShortcutsBackendFactory::GetForProfile(profile_); |
137 } | 145 } |
138 | 146 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 image_service->Prefetch(url, traffic_annotation); | 292 image_service->Prefetch(url, traffic_annotation); |
285 } | 293 } |
286 | 294 |
287 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( | 295 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( |
288 AutocompleteController* controller) { | 296 AutocompleteController* controller) { |
289 content::NotificationService::current()->Notify( | 297 content::NotificationService::current()->Notify( |
290 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 298 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
291 content::Source<AutocompleteController>(controller), | 299 content::Source<AutocompleteController>(controller), |
292 content::NotificationService::NoDetails()); | 300 content::NotificationService::NoDetails()); |
293 } | 301 } |
OLD | NEW |