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

Side by Side Diff: chrome/browser/themes/theme_service_factory.cc

Issue 6813116: Revert 81277 - Profile shouldn't own DesktopNotificationService.DesktopNotificationService is now... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_dependency_manager.h" 10 #include "chrome/browser/profiles/profile_dependency_manager.h"
11 #include "chrome/browser/themes/theme_service.h" 11 #include "chrome/browser/themes/theme_service.h"
12 #include "content/common/notification_service.h" 12 #include "content/common/notification_service.h"
13 13
14 #if defined(TOOLKIT_USES_GTK) 14 #if defined(TOOLKIT_USES_GTK)
15 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
16 #endif 16 #endif
17 17
18 // static 18 // static
19 ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { 19 ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) {
20 return static_cast<ThemeService*>( 20 return static_cast<ThemeService*>(
21 GetInstance()->GetServiceForProfile(profile)); 21 GetInstance()->GetServiceForProfile(profile));
22 } 22 }
23 23
24 // static
25 const Extension* ThemeServiceFactory::GetThemeForProfile(Profile* profile) { 24 const Extension* ThemeServiceFactory::GetThemeForProfile(Profile* profile) {
26 std::string id = GetForProfile(profile)->GetThemeID(); 25 std::string id = GetForProfile(profile)->GetThemeID();
27 if (id == ThemeService::kDefaultThemeID) 26 if (id == ThemeService::kDefaultThemeID)
28 return NULL; 27 return NULL;
29 28
30 return profile->GetExtensionService()->GetExtensionById(id, false); 29 return profile->GetExtensionService()->GetExtensionById(id, false);
31 } 30 }
32 31
33 // static 32 void ThemeServiceFactory::ForceAssociationBetween(Profile* profile,
33 ThemeService* provider) {
34 GetInstance()->Associate(profile, provider);
35 }
36
34 ThemeServiceFactory* ThemeServiceFactory::GetInstance() { 37 ThemeServiceFactory* ThemeServiceFactory::GetInstance() {
35 return Singleton<ThemeServiceFactory>::get(); 38 return Singleton<ThemeServiceFactory>::get();
36 } 39 }
37 40
38 ThemeServiceFactory::ThemeServiceFactory() 41 ThemeServiceFactory::ThemeServiceFactory()
39 : ProfileKeyedServiceFactory( 42 : ProfileKeyedServiceFactory(
40 ProfileDependencyManager::GetInstance()) 43 ProfileDependencyManager::GetInstance())
41 {} 44 {}
42 45
43 ThemeServiceFactory::~ThemeServiceFactory() {} 46 ThemeServiceFactory::~ThemeServiceFactory() {}
44 47
45 ProfileKeyedService* ThemeServiceFactory::BuildServiceInstanceFor( 48 ProfileKeyedService* ThemeServiceFactory::BuildServiceInstanceFor(
46 Profile* profile) const { 49 Profile* profile) const {
47 ThemeService* provider = NULL; 50 ThemeService* provider = NULL;
48 #if defined(TOOLKIT_USES_GTK) 51 #if defined(TOOLKIT_USES_GTK)
49 provider = new GtkThemeService; 52 provider = new GtkThemeService;
50 #else 53 #else
51 provider = new ThemeService; 54 provider = new ThemeService;
52 #endif 55 #endif
53 provider->Init(profile); 56 provider->Init(profile);
54 57
55 return provider; 58 return provider;
56 } 59 }
57 60
58 bool ThemeServiceFactory::ServiceRedirectedInIncognito() { 61 bool ThemeServiceFactory::ServiceRedirectedInIncognito() {
59 return true; 62 return true;
60 } 63 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_service_factory.h ('k') | chrome/browser/ui/cocoa/notifications/balloon_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698