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

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

Issue 383903003: ifdef various extensions code to be used only when extensions are enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/media/media_stream_capture_indicator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/autocomplete_classifier_factory.h" 5 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
6 6
7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
8 #include "chrome/browser/autocomplete/autocomplete_controller.h" 8 #include "chrome/browser/autocomplete/autocomplete_controller.h"
9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
10 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" 10 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
11 #include "chrome/browser/profiles/incognito_helpers.h" 11 #include "chrome/browser/profiles/incognito_helpers.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/search_engines/template_url_service_factory.h" 13 #include "chrome/browser/search_engines/template_url_service_factory.h"
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" 14 #include "components/keyed_service/content/browser_context_dependency_manager.h"
15
16 #if defined(ENABLE_EXTENSIONS)
15 #include "extensions/browser/extension_system_provider.h" 17 #include "extensions/browser/extension_system_provider.h"
16 #include "extensions/browser/extensions_browser_client.h" 18 #include "extensions/browser/extensions_browser_client.h"
19 #endif
17 20
18 // static 21 // static
19 AutocompleteClassifier* AutocompleteClassifierFactory::GetForProfile( 22 AutocompleteClassifier* AutocompleteClassifierFactory::GetForProfile(
20 Profile* profile) { 23 Profile* profile) {
21 return static_cast<AutocompleteClassifier*>( 24 return static_cast<AutocompleteClassifier*>(
22 GetInstance()->GetServiceForBrowserContext(profile, true)); 25 GetInstance()->GetServiceForBrowserContext(profile, true));
23 } 26 }
24 27
25 // static 28 // static
26 AutocompleteClassifierFactory* AutocompleteClassifierFactory::GetInstance() { 29 AutocompleteClassifierFactory* AutocompleteClassifierFactory::GetInstance() {
27 return Singleton<AutocompleteClassifierFactory>::get(); 30 return Singleton<AutocompleteClassifierFactory>::get();
28 } 31 }
29 32
30 // static 33 // static
31 KeyedService* AutocompleteClassifierFactory::BuildInstanceFor( 34 KeyedService* AutocompleteClassifierFactory::BuildInstanceFor(
32 content::BrowserContext* context) { 35 content::BrowserContext* context) {
33 Profile* profile = static_cast<Profile*>(context); 36 Profile* profile = static_cast<Profile*>(context);
34 return new AutocompleteClassifier( 37 return new AutocompleteClassifier(
35 make_scoped_ptr(new AutocompleteController( 38 make_scoped_ptr(new AutocompleteController(
36 profile, TemplateURLServiceFactory::GetForProfile(profile), NULL, 39 profile, TemplateURLServiceFactory::GetForProfile(profile), NULL,
37 AutocompleteClassifier::kDefaultOmniboxProviders)), 40 AutocompleteClassifier::kDefaultOmniboxProviders)),
38 scoped_ptr<AutocompleteSchemeClassifier>( 41 scoped_ptr<AutocompleteSchemeClassifier>(
39 new ChromeAutocompleteSchemeClassifier(profile))); 42 new ChromeAutocompleteSchemeClassifier(profile)));
40 } 43 }
41 44
42 AutocompleteClassifierFactory::AutocompleteClassifierFactory() 45 AutocompleteClassifierFactory::AutocompleteClassifierFactory()
43 : BrowserContextKeyedServiceFactory( 46 : BrowserContextKeyedServiceFactory(
44 "AutocompleteClassifier", 47 "AutocompleteClassifier",
45 BrowserContextDependencyManager::GetInstance()) { 48 BrowserContextDependencyManager::GetInstance()) {
49 #if defined(ENABLE_EXTENSIONS)
46 DependsOn( 50 DependsOn(
47 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); 51 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
52 #endif
48 DependsOn(TemplateURLServiceFactory::GetInstance()); 53 DependsOn(TemplateURLServiceFactory::GetInstance());
49 // TODO(pkasting): Uncomment these once they exist. 54 // TODO(pkasting): Uncomment these once they exist.
50 // DependsOn(PrefServiceFactory::GetInstance()); 55 // DependsOn(PrefServiceFactory::GetInstance());
51 DependsOn(ShortcutsBackendFactory::GetInstance()); 56 DependsOn(ShortcutsBackendFactory::GetInstance());
52 } 57 }
53 58
54 AutocompleteClassifierFactory::~AutocompleteClassifierFactory() { 59 AutocompleteClassifierFactory::~AutocompleteClassifierFactory() {
55 } 60 }
56 61
57 content::BrowserContext* AutocompleteClassifierFactory::GetBrowserContextToUse( 62 content::BrowserContext* AutocompleteClassifierFactory::GetBrowserContextToUse(
58 content::BrowserContext* context) const { 63 content::BrowserContext* context) const {
59 return chrome::GetBrowserContextRedirectedInIncognito(context); 64 return chrome::GetBrowserContextRedirectedInIncognito(context);
60 } 65 }
61 66
62 bool AutocompleteClassifierFactory::ServiceIsNULLWhileTesting() const { 67 bool AutocompleteClassifierFactory::ServiceIsNULLWhileTesting() const {
63 return true; 68 return true;
64 } 69 }
65 70
66 KeyedService* AutocompleteClassifierFactory::BuildServiceInstanceFor( 71 KeyedService* AutocompleteClassifierFactory::BuildServiceInstanceFor(
67 content::BrowserContext* profile) const { 72 content::BrowserContext* profile) const {
68 return BuildInstanceFor(static_cast<Profile*>(profile)); 73 return BuildInstanceFor(static_cast<Profile*>(profile));
69 } 74 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/media_stream_capture_indicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698