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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_service_factory.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/push_messaging/push_messaging_service_factory.h" 5 #include "chrome/browser/push_messaging/push_messaging_service_factory.h"
6 6
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
8 #include "chrome/browser/profiles/incognito_helpers.h" 8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" 10 #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
11 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" 11 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h"
12 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" 12 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
13 #include "components/keyed_service/content/browser_context_dependency_manager.h" 13 #include "components/keyed_service/content/browser_context_dependency_manager.h"
14 14
15 // static 15 // static
16 PushMessagingServiceImpl* PushMessagingServiceFactory::GetForProfile( 16 PushMessagingServiceImpl* PushMessagingServiceFactory::GetForProfile(
17 content::BrowserContext* profile) { 17 content::BrowserContext* profile) {
18 // The Push API is not currently supported in incognito mode. 18 // The Push API is not currently supported in incognito mode.
19 // See https://crbug.com/401439. 19 // See https://crbug.com/401439.
20 if (profile->IsOffTheRecord()) 20 if (profile->IsOffTheRecord())
21 return NULL; 21 return NULL;
22 22
23 return static_cast<PushMessagingServiceImpl*>( 23 return static_cast<PushMessagingServiceImpl*>(
24 GetInstance()->GetServiceForBrowserContext(profile, true)); 24 GetInstance()->GetServiceForBrowserContext(profile, true));
25 } 25 }
26 26
27 // static 27 // static
28 PushMessagingServiceFactory* PushMessagingServiceFactory::GetInstance() { 28 PushMessagingServiceFactory* PushMessagingServiceFactory::GetInstance() {
29 return Singleton<PushMessagingServiceFactory>::get(); 29 return base::Singleton<PushMessagingServiceFactory>::get();
30 } 30 }
31 31
32 PushMessagingServiceFactory::PushMessagingServiceFactory() 32 PushMessagingServiceFactory::PushMessagingServiceFactory()
33 : BrowserContextKeyedServiceFactory( 33 : BrowserContextKeyedServiceFactory(
34 "PushMessagingProfileService", 34 "PushMessagingProfileService",
35 BrowserContextDependencyManager::GetInstance()) { 35 BrowserContextDependencyManager::GetInstance()) {
36 DependsOn(gcm::GCMProfileServiceFactory::GetInstance()); 36 DependsOn(gcm::GCMProfileServiceFactory::GetInstance());
37 DependsOn(HostContentSettingsMapFactory::GetInstance()); 37 DependsOn(HostContentSettingsMapFactory::GetInstance());
38 } 38 }
39 39
40 PushMessagingServiceFactory::~PushMessagingServiceFactory() { 40 PushMessagingServiceFactory::~PushMessagingServiceFactory() {
41 } 41 }
42 42
43 KeyedService* PushMessagingServiceFactory::BuildServiceInstanceFor( 43 KeyedService* PushMessagingServiceFactory::BuildServiceInstanceFor(
44 content::BrowserContext* context) const { 44 content::BrowserContext* context) const {
45 Profile* profile = Profile::FromBrowserContext(context); 45 Profile* profile = Profile::FromBrowserContext(context);
46 CHECK(!profile->IsOffTheRecord()); 46 CHECK(!profile->IsOffTheRecord());
47 return new PushMessagingServiceImpl(profile); 47 return new PushMessagingServiceImpl(profile);
48 } 48 }
49 49
50 content::BrowserContext* PushMessagingServiceFactory::GetBrowserContextToUse( 50 content::BrowserContext* PushMessagingServiceFactory::GetBrowserContextToUse(
51 content::BrowserContext* context) const { 51 content::BrowserContext* context) const {
52 return chrome::GetBrowserContextOwnInstanceInIncognito(context); 52 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
53 } 53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698