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

Side by Side Diff: chrome/browser/services/gcm/gcm_profile_service_factory.cc

Issue 60673002: Create services/gcm directory and add some initial files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Created 7 years, 1 month 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
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698