OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/notifier/chrome_notifier_service_factory.h" | |
6 | |
7 #include "chrome/browser/browser_process.h" | |
8 #include "chrome/browser/notifier/chrome_notifier_service.h" | |
9 #include "chrome/browser/prefs/pref_service.h" | |
10 #include "chrome/browser/profiles/profile_dependency_manager.h" | |
11 | |
12 // static | |
13 ChromeNotifierService* ChromeNotifierServiceFactory::GetForProfile( | |
14 Profile* profile, Profile::ServiceAccessType sat) { | |
15 return static_cast<ChromeNotifierService*>( | |
16 GetInstance()->GetServiceForProfile(profile, true)); | |
17 } | |
18 | |
19 // static | |
20 ChromeNotifierService* | |
21 ChromeNotifierServiceFactory::GetForProfileIfExists( | |
22 Profile* profile, Profile::ServiceAccessType sat) { | |
23 return static_cast<ChromeNotifierService*>( | |
24 GetInstance()->GetServiceForProfile(profile, false)); | |
25 } | |
26 | |
27 // static | |
28 ChromeNotifierService* | |
29 ChromeNotifierServiceFactory::GetForProfileWithoutCreating(Profile* profile) { | |
30 return static_cast<ChromeNotifierService*>( | |
31 GetInstance()->GetServiceForProfile(profile, false)); | |
32 } | |
33 | |
34 // static | |
35 ChromeNotifierServiceFactory* ChromeNotifierServiceFactory::GetInstance() { | |
36 return Singleton<ChromeNotifierServiceFactory>::get(); | |
37 } | |
38 | |
39 ChromeNotifierServiceFactory::ChromeNotifierServiceFactory() | |
40 : ProfileKeyedServiceFactory( | |
41 "ChromeNotifierService", ProfileDependencyManager::GetInstance()) {} | |
42 | |
43 ChromeNotifierServiceFactory::~ChromeNotifierServiceFactory() { | |
44 } | |
45 | |
46 ProfileKeyedService* | |
47 ChromeNotifierServiceFactory::BuildServiceInstanceFor(Profile* profile) const { | |
48 // TODO: This assumes the notification_ui_manager remains valid throughout the | |
dcheng
2013/01/18 21:56:13
TODO's should have an associated name.
Pete Williamson
2013/01/23 01:45:55
Instead, I just did the research and removed the T
| |
49 // session. Is that a good assumption? | |
50 NotificationUIManager* notification_manager = | |
51 g_browser_process->notification_ui_manager(); | |
52 ChromeNotifierService* chrome_notifier_service = | |
53 new ChromeNotifierService(profile, notification_manager); | |
54 return chrome_notifier_service; | |
55 } | |
56 | |
57 bool ChromeNotifierServiceFactory::ServiceRedirectedInIncognito() const { | |
58 return true; | |
dcheng
2013/01/18 21:56:13
It might be helpful to comment why we can't just u
Pete Williamson
2013/01/23 01:45:55
Started an email thread to find the right setting
| |
59 } | |
60 | |
61 bool ChromeNotifierServiceFactory::ServiceIsNULLWhileTesting() const { | |
62 return true; | |
63 } | |
64 | |
65 bool ChromeNotifierServiceFactory::ServiceIsCreatedWithProfile() const { | |
66 return true; | |
67 } | |
OLD | NEW |