blob: 30557fa55f61e01e22fe3da191bedf5f3885d6a8 [file] [log] [blame]
[email protected]810ffba2012-06-12 01:07:481// 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.
4
5#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
6
7#include "chrome/browser/autocomplete/autocomplete_classifier.h"
8#include "chrome/browser/extensions/extension_system_factory.h"
9#include "chrome/browser/profiles/profile_dependency_manager.h"
10#include "chrome/browser/search_engines/template_url_service_factory.h"
11
12
13// static
14AutocompleteClassifier* AutocompleteClassifierFactory::GetForProfile(
15 Profile* profile) {
16 return static_cast<AutocompleteClassifier*>(
17 GetInstance()->GetServiceForProfile(profile, true));
18}
19
20// static
21AutocompleteClassifierFactory* AutocompleteClassifierFactory::GetInstance() {
22 return Singleton<AutocompleteClassifierFactory>::get();
23}
24
25// static
26ProfileKeyedService* AutocompleteClassifierFactory::BuildInstanceFor(
27 Profile* profile) {
28 return new AutocompleteClassifier(profile);
29}
30
31AutocompleteClassifierFactory::AutocompleteClassifierFactory()
32 : ProfileKeyedServiceFactory("AutocompleteClassifier",
33 ProfileDependencyManager::GetInstance()) {
34 DependsOn(ExtensionSystemFactory::GetInstance());
35 DependsOn(TemplateURLServiceFactory::GetInstance());
36 // TODO(pkasting): Uncomment these once they exist.
37 // DependsOn(PrefServiceFactory::GetInstance());
38 // DependsOn(ShortcutsBackendFactory::GetInstance());
39}
40
41AutocompleteClassifierFactory::~AutocompleteClassifierFactory() {
42}
43
44bool AutocompleteClassifierFactory::ServiceRedirectedInIncognito() {
45 return true;
46}
47
48bool AutocompleteClassifierFactory::ServiceIsNULLWhileTesting() {
49 return true;
50}
51
52ProfileKeyedService* AutocompleteClassifierFactory::BuildServiceInstanceFor(
53 Profile* profile) const {
54 return BuildInstanceFor(profile);
55}