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

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

Issue 1192373002: Prepare AutocompleteController for componentization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@componentize_zero_suggest_provider
Patch Set: Remove stale include Created 5 years, 6 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 "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 8 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
10 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h"
10 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" 11 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" 12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h"
12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" 13 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h"
13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
14 #include "chrome/browser/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/history/history_service_factory.h" 16 #include "chrome/browser/history/history_service_factory.h"
16 #include "chrome/browser/history/top_sites_factory.h" 17 #include "chrome/browser/history/top_sites_factory.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/search_engines/template_url_service_factory.h" 19 #include "chrome/browser/search_engines/template_url_service_factory.h"
19 #include "chrome/browser/sync/profile_sync_service.h" 20 #include "chrome/browser/sync/profile_sync_service.h"
20 #include "chrome/browser/sync/profile_sync_service_factory.h" 21 #include "chrome/browser/sync/profile_sync_service_factory.h"
21 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
22 #include "components/history/core/browser/history_service.h" 23 #include "components/history/core/browser/history_service.h"
23 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
24 25
26 #if defined(ENABLE_EXTENSIONS)
27 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h"
28 #endif
29
25 ChromeAutocompleteProviderClient::ChromeAutocompleteProviderClient( 30 ChromeAutocompleteProviderClient::ChromeAutocompleteProviderClient(
26 Profile* profile) 31 Profile* profile)
27 : profile_(profile), 32 : profile_(profile),
28 scheme_classifier_(profile), 33 scheme_classifier_(profile),
29 search_terms_data_(profile_) { 34 search_terms_data_(profile_) {
30 } 35 }
31 36
32 ChromeAutocompleteProviderClient::~ChromeAutocompleteProviderClient() { 37 ChromeAutocompleteProviderClient::~ChromeAutocompleteProviderClient() {
33 } 38 }
34 39
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 71 }
67 72
68 history::URLDatabase* ChromeAutocompleteProviderClient::GetInMemoryDatabase() { 73 history::URLDatabase* ChromeAutocompleteProviderClient::GetInMemoryDatabase() {
69 history::HistoryService* history_service = GetHistoryService(); 74 history::HistoryService* history_service = GetHistoryService();
70 75
71 // This method is called in unit test contexts where the HistoryService isn't 76 // This method is called in unit test contexts where the HistoryService isn't
72 // loaded. 77 // loaded.
73 return history_service ? history_service->InMemoryDatabase() : NULL; 78 return history_service ? history_service->InMemoryDatabase() : NULL;
74 } 79 }
75 80
81 InMemoryURLIndex* ChromeAutocompleteProviderClient::GetInMemoryURLIndex() {
82 return InMemoryURLIndexFactory::GetForProfile(profile_);
83 }
84
76 TemplateURLService* ChromeAutocompleteProviderClient::GetTemplateURLService() { 85 TemplateURLService* ChromeAutocompleteProviderClient::GetTemplateURLService() {
77 return TemplateURLServiceFactory::GetForProfile(profile_); 86 return TemplateURLServiceFactory::GetForProfile(profile_);
78 } 87 }
79 88
80 const SearchTermsData& ChromeAutocompleteProviderClient::GetSearchTermsData() { 89 const SearchTermsData& ChromeAutocompleteProviderClient::GetSearchTermsData() {
81 return search_terms_data_; 90 return search_terms_data_;
82 } 91 }
83 92
84 scoped_refptr<ShortcutsBackend> 93 scoped_refptr<ShortcutsBackend>
85 ChromeAutocompleteProviderClient::GetShortcutsBackend() { 94 ChromeAutocompleteProviderClient::GetShortcutsBackend() {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 image_service->Prefetch(url); 153 image_service->Prefetch(url);
145 } 154 }
146 155
147 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( 156 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady(
148 AutocompleteController* controller) { 157 AutocompleteController* controller) {
149 content::NotificationService::current()->Notify( 158 content::NotificationService::current()->Notify(
150 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, 159 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY,
151 content::Source<AutocompleteController>(controller), 160 content::Source<AutocompleteController>(controller),
152 content::NotificationService::NoDetails()); 161 content::NotificationService::NoDetails());
153 } 162 }
163
164 void ChromeAutocompleteProviderClient::ConfigureKeywordProvider(
Peter Kasting 2015/06/19 19:19:21 Nit: Why not instead have something like scoped_p
blundell 2015/06/22 09:01:36 Done.
165 KeywordProvider* keyword_provider) {
166 #if defined(ENABLE_EXTENSIONS)
167 keyword_provider->set_extensions_delegate(
168 scoped_ptr<KeywordExtensionsDelegate>(
Peter Kasting 2015/06/19 19:19:21 Nit: make_scoped_ptr?
blundell 2015/06/22 09:01:36 Done.
169 new KeywordExtensionsDelegateImpl(profile_, keyword_provider)));
170 #endif
171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698