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

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 to land 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
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service_factory.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/profiles/incognito_helpers.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/services/gcm/gcm_profile_service.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
11
12 namespace gcm {
13
14 // static
15 GCMProfileService* GCMProfileServiceFactory::GetForProfile(Profile* profile) {
16 if (!gcm::GCMProfileService::IsGCMEnabled())
17 return NULL;
18
19 return static_cast<GCMProfileService*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true));
21 }
22
23 // static
24 GCMProfileServiceFactory* GCMProfileServiceFactory::GetInstance() {
25 return Singleton<GCMProfileServiceFactory>::get();
26 }
27
28 GCMProfileServiceFactory::GCMProfileServiceFactory()
29 : BrowserContextKeyedServiceFactory(
30 "GCMProfileService",
31 BrowserContextDependencyManager::GetInstance()) {
32 }
33
34 GCMProfileServiceFactory::~GCMProfileServiceFactory() {
35 }
36
37 BrowserContextKeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor(
38 content::BrowserContext* profile) const {
39 return gcm::GCMProfileService::IsGCMEnabled() ?
40 new GCMProfileService(static_cast<Profile*>(profile)) : NULL;
41 }
42
43 content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse(
44 content::BrowserContext* context) const {
45 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
46 }
47
48 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service_factory.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698