| 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/gtk_theme_service.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 extensions::Extension* ThemeServiceFactory::GetThemeForProfile( |
| 27 Profile* profile) { |
| 27 std::string id = GetForProfile(profile)->GetThemeID(); | 28 std::string id = GetForProfile(profile)->GetThemeID(); |
| 28 if (id == ThemeService::kDefaultThemeID) | 29 if (id == ThemeService::kDefaultThemeID) |
| 29 return NULL; | 30 return NULL; |
| 30 | 31 |
| 31 return profile->GetExtensionService()->GetExtensionById(id, false); | 32 return profile->GetExtensionService()->GetExtensionById(id, false); |
| 32 } | 33 } |
| 33 | 34 |
| 34 // static | 35 // static |
| 35 ThemeServiceFactory* ThemeServiceFactory::GetInstance() { | 36 ThemeServiceFactory* ThemeServiceFactory::GetInstance() { |
| 36 return Singleton<ThemeServiceFactory>::get(); | 37 return Singleton<ThemeServiceFactory>::get(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 PrefService::UNSYNCABLE_PREF); | 75 PrefService::UNSYNCABLE_PREF); |
| 75 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints, | 76 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints, |
| 76 PrefService::UNSYNCABLE_PREF); | 77 PrefService::UNSYNCABLE_PREF); |
| 77 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties, | 78 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties, |
| 78 PrefService::UNSYNCABLE_PREF); | 79 PrefService::UNSYNCABLE_PREF); |
| 79 } | 80 } |
| 80 | 81 |
| 81 bool ThemeServiceFactory::ServiceRedirectedInIncognito() { | 82 bool ThemeServiceFactory::ServiceRedirectedInIncognito() { |
| 82 return true; | 83 return true; |
| 83 } | 84 } |
| OLD | NEW |