OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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/services/gcm/gcm_profile_service_factory.h" | |
6 | |
7 #include "chrome/browser/browser_process.h" | |
Nicolas Zea
2013/11/05 20:17:33
is this used?
jianli
2013/11/05 20:42:32
Done.
| |
8 #include "chrome/browser/profiles/incognito_helpers.h" | |
9 #include "chrome/browser/profiles/profile.h" | |
Nicolas Zea
2013/11/05 20:17:33
you never actually do anything with the profile, s
jianli
2013/11/05 20:42:32
It is needed because we need to cast from BrowserC
| |
10 #include "chrome/browser/services/gcm/gcm_profile_service.h" | |
11 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" | |
12 #include "content/public/browser/browser_thread.h" | |
Nicolas Zea
2013/11/05 20:17:33
don't think you use this?
jianli
2013/11/05 20:42:32
Done.
| |
13 | |
14 using content::BrowserThread; | |
Nicolas Zea
2013/11/05 20:17:33
this too
jianli
2013/11/05 20:42:32
Done.
| |
15 | |
16 namespace gcm { | |
17 | |
18 // static | |
19 GCMProfileService* GCMProfileServiceFactory::GetForProfile(Profile* profile) { | |
Nicolas Zea
2013/11/05 20:17:33
same comment about having ordering consistent with
jianli
2013/11/05 20:42:32
For this file, indeed it is consistent with the or
| |
20 if (!gcm::GCMProfileService::IsGCMEnabled()) | |
21 return NULL; | |
22 | |
23 return static_cast<GCMProfileService*>( | |
24 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
25 } | |
26 | |
27 // static | |
28 GCMProfileServiceFactory* GCMProfileServiceFactory::GetInstance() { | |
29 return Singleton<GCMProfileServiceFactory>::get(); | |
30 } | |
31 | |
32 GCMProfileServiceFactory::GCMProfileServiceFactory() | |
33 : BrowserContextKeyedServiceFactory( | |
34 "GCMProfileService", | |
35 BrowserContextDependencyManager::GetInstance()) { | |
36 } | |
37 | |
38 GCMProfileServiceFactory::~GCMProfileServiceFactory() { | |
39 } | |
40 | |
41 BrowserContextKeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor( | |
42 content::BrowserContext* profile) const { | |
43 return gcm::GCMProfileService::IsGCMEnabled() ? | |
44 new GCMProfileService(static_cast<Profile*>(profile)) : NULL; | |
45 } | |
46 | |
47 content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse( | |
48 content::BrowserContext* context) const { | |
49 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | |
50 } | |
51 | |
52 } // namespace gcm | |
OLD | NEW |