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

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

Issue 2243813002: Rename BackgroundBudgetService to BudgetManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@budget_database
Patch Set: code review cleanup Created 4 years, 4 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 <memory> 7 #include <memory>
8 8
9 #include "chrome/browser/budget_service/background_budget_service_factory.h" 9 #include "chrome/browser/budget_service/budget_manager_factory.h"
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
11 #include "chrome/browser/permissions/permission_manager_factory.h" 11 #include "chrome/browser/permissions/permission_manager_factory.h"
12 #include "chrome/browser/profiles/incognito_helpers.h" 12 #include "chrome/browser/profiles/incognito_helpers.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" 14 #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
15 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" 15 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h"
16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" 16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
17 #include "components/keyed_service/content/browser_context_dependency_manager.h" 17 #include "components/keyed_service/content/browser_context_dependency_manager.h"
18 18
19 // static 19 // static
(...skipping 10 matching lines...) Expand all
30 30
31 // static 31 // static
32 PushMessagingServiceFactory* PushMessagingServiceFactory::GetInstance() { 32 PushMessagingServiceFactory* PushMessagingServiceFactory::GetInstance() {
33 return base::Singleton<PushMessagingServiceFactory>::get(); 33 return base::Singleton<PushMessagingServiceFactory>::get();
34 } 34 }
35 35
36 PushMessagingServiceFactory::PushMessagingServiceFactory() 36 PushMessagingServiceFactory::PushMessagingServiceFactory()
37 : BrowserContextKeyedServiceFactory( 37 : BrowserContextKeyedServiceFactory(
38 "PushMessagingProfileService", 38 "PushMessagingProfileService",
39 BrowserContextDependencyManager::GetInstance()) { 39 BrowserContextDependencyManager::GetInstance()) {
40 DependsOn(BackgroundBudgetServiceFactory::GetInstance()); 40 DependsOn(BudgetManagerFactory::GetInstance());
41 DependsOn(gcm::GCMProfileServiceFactory::GetInstance()); 41 DependsOn(gcm::GCMProfileServiceFactory::GetInstance());
42 DependsOn(HostContentSettingsMapFactory::GetInstance()); 42 DependsOn(HostContentSettingsMapFactory::GetInstance());
43 DependsOn(PermissionManagerFactory::GetInstance()); 43 DependsOn(PermissionManagerFactory::GetInstance());
44 } 44 }
45 45
46 PushMessagingServiceFactory::~PushMessagingServiceFactory() {} 46 PushMessagingServiceFactory::~PushMessagingServiceFactory() {}
47 47
48 void PushMessagingServiceFactory::RestoreFactoryForTests( 48 void PushMessagingServiceFactory::RestoreFactoryForTests(
49 content::BrowserContext* context) { 49 content::BrowserContext* context) {
50 SetTestingFactory(context, [](content::BrowserContext* context) { 50 SetTestingFactory(context, [](content::BrowserContext* context) {
51 return std::unique_ptr<KeyedService>( 51 return std::unique_ptr<KeyedService>(
52 GetInstance()->BuildServiceInstanceFor(context)); 52 GetInstance()->BuildServiceInstanceFor(context));
53 }); 53 });
54 } 54 }
55 55
56 KeyedService* PushMessagingServiceFactory::BuildServiceInstanceFor( 56 KeyedService* PushMessagingServiceFactory::BuildServiceInstanceFor(
57 content::BrowserContext* context) const { 57 content::BrowserContext* context) const {
58 Profile* profile = Profile::FromBrowserContext(context); 58 Profile* profile = Profile::FromBrowserContext(context);
59 CHECK(!profile->IsOffTheRecord()); 59 CHECK(!profile->IsOffTheRecord());
60 return new PushMessagingServiceImpl(profile); 60 return new PushMessagingServiceImpl(profile);
61 } 61 }
62 62
63 content::BrowserContext* PushMessagingServiceFactory::GetBrowserContextToUse( 63 content::BrowserContext* PushMessagingServiceFactory::GetBrowserContextToUse(
64 content::BrowserContext* context) const { 64 content::BrowserContext* context) const {
65 return chrome::GetBrowserContextOwnInstanceInIncognito(context); 65 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698