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

Side by Side Diff: chrome/browser/services/gcm/instance_id/instance_id_profile_service_factory.cc

Issue 2657823005: Move //c/b/services/gcm/ to //c/b/gcm/ (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
(Empty)
1 // Copyright (c) 2015 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/instance_id/instance_id_profile_service_fa ctory.h"
6
7 #include <memory>
8
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
12 #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service.h"
13 #include "components/keyed_service/content/browser_context_dependency_manager.h"
14
15 namespace instance_id {
16
17 // static
18 InstanceIDProfileService* InstanceIDProfileServiceFactory::GetForProfile(
19 content::BrowserContext* profile) {
20 // Instance ID is not supported in incognito mode.
21 if (profile->IsOffTheRecord())
22 return NULL;
23
24 return static_cast<InstanceIDProfileService*>(
25 GetInstance()->GetServiceForBrowserContext(profile, true));
26 }
27
28 // static
29 InstanceIDProfileServiceFactory*
30 InstanceIDProfileServiceFactory::GetInstance() {
31 return base::Singleton<InstanceIDProfileServiceFactory>::get();
32 }
33
34 InstanceIDProfileServiceFactory::InstanceIDProfileServiceFactory()
35 : BrowserContextKeyedServiceFactory(
36 "InstanceIDProfileService",
37 BrowserContextDependencyManager::GetInstance()) {
38 // GCM is needed for device ID.
39 DependsOn(gcm::GCMProfileServiceFactory::GetInstance());
40 }
41
42 InstanceIDProfileServiceFactory::~InstanceIDProfileServiceFactory() {
43 }
44
45 KeyedService* InstanceIDProfileServiceFactory::BuildServiceInstanceFor(
46 content::BrowserContext* context) const {
47 return new InstanceIDProfileService(Profile::FromBrowserContext(context));
48 }
49
50 content::BrowserContext*
51 InstanceIDProfileServiceFactory::GetBrowserContextToUse(
52 content::BrowserContext* context) const {
53 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
54 }
55
56 } // namespace instance_id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698