[safe-browsing] Database full hash matches like prefix match.
[chromium-blink-merge.git] / chrome / browser / autocomplete / autocomplete_classifier_factory.cc
blobffb97810d0b4b020a23a2a91bc95ce42ef740d30
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
7 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
8 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search_engines/template_url_service_factory.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "extensions/browser/extension_system_provider.h"
14 #include "extensions/browser/extensions_browser_client.h"
16 // static
17 AutocompleteClassifier* AutocompleteClassifierFactory::GetForProfile(
18 Profile* profile) {
19 return static_cast<AutocompleteClassifier*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true));
23 // static
24 AutocompleteClassifierFactory* AutocompleteClassifierFactory::GetInstance() {
25 return Singleton<AutocompleteClassifierFactory>::get();
28 // static
29 KeyedService* AutocompleteClassifierFactory::BuildInstanceFor(
30 content::BrowserContext* profile) {
31 return new AutocompleteClassifier(static_cast<Profile*>(profile));
34 AutocompleteClassifierFactory::AutocompleteClassifierFactory()
35 : BrowserContextKeyedServiceFactory(
36 "AutocompleteClassifier",
37 BrowserContextDependencyManager::GetInstance()) {
38 DependsOn(
39 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
40 DependsOn(TemplateURLServiceFactory::GetInstance());
41 // TODO(pkasting): Uncomment these once they exist.
42 // DependsOn(PrefServiceFactory::GetInstance());
43 DependsOn(ShortcutsBackendFactory::GetInstance());
46 AutocompleteClassifierFactory::~AutocompleteClassifierFactory() {
49 content::BrowserContext* AutocompleteClassifierFactory::GetBrowserContextToUse(
50 content::BrowserContext* context) const {
51 return chrome::GetBrowserContextRedirectedInIncognito(context);
54 bool AutocompleteClassifierFactory::ServiceIsNULLWhileTesting() const {
55 return true;
58 KeyedService* AutocompleteClassifierFactory::BuildServiceInstanceFor(
59 content::BrowserContext* profile) const {
60 return BuildInstanceFor(static_cast<Profile*>(profile));