OLD | NEW |
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/themes/theme_service_factory.h" | 5 #include "chrome/browser/themes/theme_service_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/themes/theme_service.h" | 11 #include "chrome/browser/themes/theme_service.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
14 #include "components/pref_registry/pref_registry_syncable.h" | 14 #include "components/pref_registry/pref_registry_syncable.h" |
15 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 16 #include "extensions/browser/extension_registry_factory.h" |
16 | 17 |
17 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) | 18 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) |
18 #include "chrome/browser/themes/theme_service_aurax11.h" | 19 #include "chrome/browser/themes/theme_service_aurax11.h" |
19 #include "ui/views/linux_ui/linux_ui.h" | 20 #include "ui/views/linux_ui/linux_ui.h" |
20 #endif | 21 #endif |
21 | 22 |
22 // static | 23 // static |
23 ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { | 24 ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { |
24 return static_cast<ThemeService*>( | 25 return static_cast<ThemeService*>( |
25 GetInstance()->GetServiceForBrowserContext(profile, true)); | 26 GetInstance()->GetServiceForBrowserContext(profile, true)); |
(...skipping 10 matching lines...) Expand all Loading... |
36 profile)->enabled_extensions().GetByID(id); | 37 profile)->enabled_extensions().GetByID(id); |
37 } | 38 } |
38 | 39 |
39 // static | 40 // static |
40 ThemeServiceFactory* ThemeServiceFactory::GetInstance() { | 41 ThemeServiceFactory* ThemeServiceFactory::GetInstance() { |
41 return Singleton<ThemeServiceFactory>::get(); | 42 return Singleton<ThemeServiceFactory>::get(); |
42 } | 43 } |
43 | 44 |
44 ThemeServiceFactory::ThemeServiceFactory() | 45 ThemeServiceFactory::ThemeServiceFactory() |
45 : BrowserContextKeyedServiceFactory( | 46 : BrowserContextKeyedServiceFactory( |
46 "ThemeService", | 47 "ThemeService", |
47 BrowserContextDependencyManager::GetInstance()) {} | 48 BrowserContextDependencyManager::GetInstance()) { |
| 49 DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); |
| 50 } |
48 | 51 |
49 ThemeServiceFactory::~ThemeServiceFactory() {} | 52 ThemeServiceFactory::~ThemeServiceFactory() {} |
50 | 53 |
51 KeyedService* ThemeServiceFactory::BuildServiceInstanceFor( | 54 KeyedService* ThemeServiceFactory::BuildServiceInstanceFor( |
52 content::BrowserContext* profile) const { | 55 content::BrowserContext* profile) const { |
53 ThemeService* provider = NULL; | 56 ThemeService* provider = NULL; |
54 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) | 57 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) |
55 provider = new ThemeServiceAuraX11; | 58 provider = new ThemeServiceAuraX11; |
56 #else | 59 #else |
57 provider = new ThemeService; | 60 provider = new ThemeService; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 103 } |
101 | 104 |
102 content::BrowserContext* ThemeServiceFactory::GetBrowserContextToUse( | 105 content::BrowserContext* ThemeServiceFactory::GetBrowserContextToUse( |
103 content::BrowserContext* context) const { | 106 content::BrowserContext* context) const { |
104 return chrome::GetBrowserContextRedirectedInIncognito(context); | 107 return chrome::GetBrowserContextRedirectedInIncognito(context); |
105 } | 108 } |
106 | 109 |
107 bool ThemeServiceFactory::ServiceIsCreatedWithBrowserContext() const { | 110 bool ThemeServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
108 return true; | 111 return true; |
109 } | 112 } |
OLD | NEW |