| 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 "build/build_config.h" | 8 #include "build/build_config.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 "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
| 16 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
| 17 #include "extensions/browser/extension_registry_factory.h" | 17 #include "extensions/browser/extension_registry_factory.h" |
| 18 | 18 |
| 19 #if defined(OS_WIN) | 19 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) |
| 20 #include "chrome/browser/themes/theme_service_win.h" | |
| 21 #elif defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) | |
| 22 #include "chrome/browser/themes/theme_service_aurax11.h" | 20 #include "chrome/browser/themes/theme_service_aurax11.h" |
| 23 #include "ui/views/linux_ui/linux_ui.h" | 21 #include "ui/views/linux_ui/linux_ui.h" |
| 24 #endif | 22 #endif |
| 25 | 23 |
| 26 // static | 24 // static |
| 27 ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { | 25 ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { |
| 28 return static_cast<ThemeService*>( | 26 return static_cast<ThemeService*>( |
| 29 GetInstance()->GetServiceForBrowserContext(profile, true)); | 27 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 30 } | 28 } |
| 31 | 29 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 50 "ThemeService", | 48 "ThemeService", |
| 51 BrowserContextDependencyManager::GetInstance()) { | 49 BrowserContextDependencyManager::GetInstance()) { |
| 52 DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); | 50 DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); |
| 53 } | 51 } |
| 54 | 52 |
| 55 ThemeServiceFactory::~ThemeServiceFactory() {} | 53 ThemeServiceFactory::~ThemeServiceFactory() {} |
| 56 | 54 |
| 57 KeyedService* ThemeServiceFactory::BuildServiceInstanceFor( | 55 KeyedService* ThemeServiceFactory::BuildServiceInstanceFor( |
| 58 content::BrowserContext* profile) const { | 56 content::BrowserContext* profile) const { |
| 59 ThemeService* provider = NULL; | 57 ThemeService* provider = NULL; |
| 60 #if defined(OS_WIN) | 58 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) |
| 61 provider = new ThemeServiceWin; | |
| 62 #elif defined(USE_AURA) && defined(USE_X11) && !defined(OS_CHROMEOS) | |
| 63 provider = new ThemeServiceAuraX11; | 59 provider = new ThemeServiceAuraX11; |
| 64 #else | 60 #else |
| 65 provider = new ThemeService; | 61 provider = new ThemeService; |
| 66 #endif | 62 #endif |
| 67 provider->Init(static_cast<Profile*>(profile)); | 63 provider->Init(static_cast<Profile*>(profile)); |
| 68 | 64 |
| 69 return provider; | 65 return provider; |
| 70 } | 66 } |
| 71 | 67 |
| 72 void ThemeServiceFactory::RegisterProfilePrefs( | 68 void ThemeServiceFactory::RegisterProfilePrefs( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 94 } | 90 } |
| 95 | 91 |
| 96 content::BrowserContext* ThemeServiceFactory::GetBrowserContextToUse( | 92 content::BrowserContext* ThemeServiceFactory::GetBrowserContextToUse( |
| 97 content::BrowserContext* context) const { | 93 content::BrowserContext* context) const { |
| 98 return chrome::GetBrowserContextRedirectedInIncognito(context); | 94 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 99 } | 95 } |
| 100 | 96 |
| 101 bool ThemeServiceFactory::ServiceIsCreatedWithBrowserContext() const { | 97 bool ThemeServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
| 102 return true; | 98 return true; |
| 103 } | 99 } |
| OLD | NEW |