| 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 "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_dependency_manager.h" | 11 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 12 #include "chrome/browser/themes/theme_service.h" | 12 #include "chrome/browser/themes/theme_service.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 | 14 |
| 15 #if defined(TOOLKIT_GTK) | 15 #if defined(TOOLKIT_GTK) |
| 16 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { | 20 ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { |
| 21 return static_cast<ThemeService*>( | 21 return static_cast<ThemeService*>( |
| 22 GetInstance()->GetServiceForProfile(profile, true)); | 22 GetInstance()->GetServiceForProfile(profile, true)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 const Extension* ThemeServiceFactory::GetThemeForProfile(Profile* profile) { | 26 const Extension* ThemeServiceFactory::GetThemeForProfile(Profile* profile) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 : ProfileKeyedServiceFactory("ThemeService", | 40 : ProfileKeyedServiceFactory("ThemeService", |
| 41 ProfileDependencyManager::GetInstance()) | 41 ProfileDependencyManager::GetInstance()) |
| 42 {} | 42 {} |
| 43 | 43 |
| 44 ThemeServiceFactory::~ThemeServiceFactory() {} | 44 ThemeServiceFactory::~ThemeServiceFactory() {} |
| 45 | 45 |
| 46 ProfileKeyedService* ThemeServiceFactory::BuildServiceInstanceFor( | 46 ProfileKeyedService* ThemeServiceFactory::BuildServiceInstanceFor( |
| 47 Profile* profile) const { | 47 Profile* profile) const { |
| 48 ThemeService* provider = NULL; | 48 ThemeService* provider = NULL; |
| 49 #if defined(TOOLKIT_GTK) | 49 #if defined(TOOLKIT_GTK) |
| 50 provider = new ThemeServiceGtk; | 50 provider = new GtkThemeService; |
| 51 #else | 51 #else |
| 52 provider = new ThemeService; | 52 provider = new ThemeService; |
| 53 #endif | 53 #endif |
| 54 provider->Init(profile); | 54 provider->Init(profile); |
| 55 | 55 |
| 56 return provider; | 56 return provider; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ThemeServiceFactory::RegisterUserPrefs(PrefService* prefs) { | 59 void ThemeServiceFactory::RegisterUserPrefs(PrefService* prefs) { |
| 60 #if defined(TOOLKIT_GTK) | 60 #if defined(TOOLKIT_GTK) |
| 61 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, | 61 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, |
| 62 ThemeServiceGtk::DefaultUsesSystemTheme(), | 62 GtkThemeService::DefaultUsesSystemTheme(), |
| 63 PrefService::UNSYNCABLE_PREF); | 63 PrefService::UNSYNCABLE_PREF); |
| 64 #endif | 64 #endif |
| 65 prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename, | 65 prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename, |
| 66 FilePath(), | 66 FilePath(), |
| 67 PrefService::UNSYNCABLE_PREF); | 67 PrefService::UNSYNCABLE_PREF); |
| 68 prefs->RegisterStringPref(prefs::kCurrentThemeID, | 68 prefs->RegisterStringPref(prefs::kCurrentThemeID, |
| 69 ThemeService::kDefaultThemeID, | 69 ThemeService::kDefaultThemeID, |
| 70 PrefService::UNSYNCABLE_PREF); | 70 PrefService::UNSYNCABLE_PREF); |
| 71 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages, | 71 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages, |
| 72 PrefService::UNSYNCABLE_PREF); | 72 PrefService::UNSYNCABLE_PREF); |
| 73 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors, | 73 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors, |
| 74 PrefService::UNSYNCABLE_PREF); | 74 PrefService::UNSYNCABLE_PREF); |
| 75 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints, | 75 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints, |
| 76 PrefService::UNSYNCABLE_PREF); | 76 PrefService::UNSYNCABLE_PREF); |
| 77 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties, | 77 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties, |
| 78 PrefService::UNSYNCABLE_PREF); | 78 PrefService::UNSYNCABLE_PREF); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool ThemeServiceFactory::ServiceRedirectedInIncognito() { | 81 bool ThemeServiceFactory::ServiceRedirectedInIncognito() { |
| 82 return true; | 82 return true; |
| 83 } | 83 } |
| OLD | NEW |