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

Side by Side Diff: chrome/browser/content_settings/host_content_settings_map_factory.cc

Issue 2468723003: Move session service and supervised users to buildflags. (Closed)
Patch Set: Created 4 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
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/content_settings/host_content_settings_map_factory.h" 5 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/prefs/pref_service_syncable_util.h" 9 #include "chrome/browser/prefs/pref_service_syncable_util.h"
10 #include "chrome/browser/profiles/off_the_record_profile_impl.h" 10 #include "chrome/browser/profiles/off_the_record_profile_impl.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "components/content_settings/core/browser/host_content_settings_map.h" 12 #include "components/content_settings/core/browser/host_content_settings_map.h"
13 #include "components/keyed_service/content/browser_context_dependency_manager.h" 13 #include "components/keyed_service/content/browser_context_dependency_manager.h"
14 #include "components/sync_preferences/pref_service_syncable.h" 14 #include "components/sync_preferences/pref_service_syncable.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 16
17 #if defined(ENABLE_EXTENSIONS) 17 #if defined(ENABLE_EXTENSIONS)
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "extensions/browser/extension_system.h" 19 #include "extensions/browser/extension_system.h"
20 #include "extensions/browser/extension_system_provider.h" 20 #include "extensions/browser/extension_system_provider.h"
21 #include "extensions/browser/extensions_browser_client.h" 21 #include "extensions/browser/extensions_browser_client.h"
22 #endif 22 #endif
23 23
24 #if defined(ENABLE_SUPERVISED_USERS) 24 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
25 #include "chrome/browser/content_settings/content_settings_supervised_provider.h " 25 #include "chrome/browser/content_settings/content_settings_supervised_provider.h "
26 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" 26 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
27 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h" 27 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h"
28 #endif 28 #endif
29 29
30 HostContentSettingsMapFactory::HostContentSettingsMapFactory() 30 HostContentSettingsMapFactory::HostContentSettingsMapFactory()
31 : RefcountedBrowserContextKeyedServiceFactory( 31 : RefcountedBrowserContextKeyedServiceFactory(
32 "HostContentSettingsMap", 32 "HostContentSettingsMap",
33 BrowserContextDependencyManager::GetInstance()) { 33 BrowserContextDependencyManager::GetInstance()) {
34 #if defined(ENABLE_SUPERVISED_USERS) 34 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
35 DependsOn(SupervisedUserSettingsServiceFactory::GetInstance()); 35 DependsOn(SupervisedUserSettingsServiceFactory::GetInstance());
36 #endif 36 #endif
37 #if defined(ENABLE_EXTENSIONS) 37 #if defined(ENABLE_EXTENSIONS)
38 DependsOn( 38 DependsOn(
39 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); 39 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
40 #endif 40 #endif
41 } 41 }
42 42
43 HostContentSettingsMapFactory::~HostContentSettingsMapFactory() { 43 HostContentSettingsMapFactory::~HostContentSettingsMapFactory() {
44 } 44 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 #if defined(ENABLE_EXTENSIONS) 89 #if defined(ENABLE_EXTENSIONS)
90 ExtensionService *ext_service = 90 ExtensionService *ext_service =
91 extensions::ExtensionSystem::Get(profile)->extension_service(); 91 extensions::ExtensionSystem::Get(profile)->extension_service();
92 // This may be null in testing or when the extenion_service hasn't been 92 // This may be null in testing or when the extenion_service hasn't been
93 // initialized, in which case it will be registered then. 93 // initialized, in which case it will be registered then.
94 if (ext_service) 94 if (ext_service)
95 ext_service->RegisterContentSettings(settings_map.get()); 95 ext_service->RegisterContentSettings(settings_map.get());
96 #endif // defined(ENABLE_EXTENSIONS) 96 #endif // defined(ENABLE_EXTENSIONS)
97 #if defined(ENABLE_SUPERVISED_USERS) 97 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
98 SupervisedUserSettingsService* supervised_service = 98 SupervisedUserSettingsService* supervised_service =
99 SupervisedUserSettingsServiceFactory::GetForProfile(profile); 99 SupervisedUserSettingsServiceFactory::GetForProfile(profile);
100 // This may be null in testing. 100 // This may be null in testing.
101 if (supervised_service) { 101 if (supervised_service) {
102 std::unique_ptr<content_settings::SupervisedProvider> supervised_provider( 102 std::unique_ptr<content_settings::SupervisedProvider> supervised_provider(
103 new content_settings::SupervisedProvider(supervised_service)); 103 new content_settings::SupervisedProvider(supervised_service));
104 settings_map->RegisterProvider(HostContentSettingsMap::SUPERVISED_PROVIDER, 104 settings_map->RegisterProvider(HostContentSettingsMap::SUPERVISED_PROVIDER,
105 std::move(supervised_provider)); 105 std::move(supervised_provider));
106 } 106 }
107 #endif // defined(ENABLE_SUPERVISED_USERS) 107 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
108 108
109 return settings_map; 109 return settings_map;
110 } 110 }
111 111
112 content::BrowserContext* HostContentSettingsMapFactory::GetBrowserContextToUse( 112 content::BrowserContext* HostContentSettingsMapFactory::GetBrowserContextToUse(
113 content::BrowserContext* context) const { 113 content::BrowserContext* context) const {
114 return context; 114 return context;
115 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover_factory.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698