Update V8 to version 4.7.21.
[chromium-blink-merge.git] / chrome / browser / profiles / chrome_browser_main_extra_parts_profiles.cc
blobc51506d2be07c9c6e7292953e5f747400c5a21a6
1 // Copyright 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.
5 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h"
7 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h"
8 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
9 #include "chrome/browser/autofill/personal_data_manager_factory.h"
10 #include "chrome/browser/background/background_contents_service_factory.h"
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
12 #include "chrome/browser/chrome_browser_main.h"
13 #include "chrome/browser/content_settings/cookie_settings_factory.h"
14 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
15 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
16 #include "chrome/browser/domain_reliability/service_factory.h"
17 #include "chrome/browser/download/download_service_factory.h"
18 #include "chrome/browser/engagement/site_engagement_service.h"
19 #include "chrome/browser/engagement/site_engagement_service_factory.h"
20 #include "chrome/browser/favicon/favicon_service_factory.h"
21 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
22 #include "chrome/browser/google/google_url_tracker_factory.h"
23 #include "chrome/browser/history/history_service_factory.h"
24 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
25 #include "chrome/browser/media_galleries/media_galleries_preferences_factory.h"
26 #include "chrome/browser/notifications/extension_welcome_notification_factory.h"
27 #include "chrome/browser/notifications/notification_permission_context_factory.h"
28 #include "chrome/browser/notifications/notifier_state_tracker_factory.h"
29 #include "chrome/browser/password_manager/password_store_factory.h"
30 #include "chrome/browser/plugins/plugin_prefs_factory.h"
31 #include "chrome/browser/policy/profile_policy_connector_factory.h"
32 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h"
33 #include "chrome/browser/predictors/predictor_database_factory.h"
34 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
35 #include "chrome/browser/prerender/prerender_link_manager_factory.h"
36 #include "chrome/browser/prerender/prerender_manager_factory.h"
37 #include "chrome/browser/prerender/prerender_message_filter.h"
38 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.h"
39 #include "chrome/browser/profiles/gaia_info_update_service_factory.h"
40 #include "chrome/browser/search/instant_service_factory.h"
41 #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
42 #include "chrome/browser/search_engines/template_url_fetcher_factory.h"
43 #include "chrome/browser/search_engines/template_url_service_factory.h"
44 #include "chrome/browser/sessions/session_service_factory.h"
45 #include "chrome/browser/sessions/tab_restore_service_factory.h"
46 #include "chrome/browser/signin/about_signin_internals_factory.h"
47 #include "chrome/browser/signin/account_fetcher_service_factory.h"
48 #include "chrome/browser/signin/account_tracker_service_factory.h"
49 #include "chrome/browser/signin/signin_manager_factory.h"
50 #include "chrome/browser/sync/profile_sync_service_factory.h"
51 #include "chrome/browser/themes/theme_service_factory.h"
52 #include "chrome/browser/thumbnails/thumbnail_service_factory.h"
53 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
54 #include "chrome/browser/ui/find_bar/find_bar_state_factory.h"
55 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
56 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
57 #include "chrome/browser/ui/tabs/pinned_tab_service_factory.h"
58 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h"
59 #include "chrome/browser/undo/bookmark_undo_service_factory.h"
60 #include "chrome/browser/web_data_service_factory.h"
62 #if defined(ENABLE_EXTENSIONS)
63 #include "apps/browser_context_keyed_service_factories.h"
64 #include "chrome/browser/apps/ephemeral_app_service_factory.h"
65 #include "chrome/browser/apps/shortcut_manager_factory.h"
66 #include "chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.h"
67 #include "chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.h"
68 #include "chrome/browser/extensions/browser_context_keyed_service_factories.h"
69 #include "chrome/browser/extensions/extension_management.h"
70 #include "chrome/browser/search/hotword_service_factory.h"
71 #include "chrome/browser/signin/easy_unlock_service_factory.h"
72 #include "chrome/browser/ui/bookmarks/enhanced_bookmark_key_service_factory.h"
73 #include "extensions/browser/api/networking_private/networking_private_delegate_factory.h"
74 #include "extensions/browser/browser_context_keyed_service_factories.h"
75 #endif
77 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
78 #include "chrome/browser/captive_portal/captive_portal_service_factory.h"
79 #endif
81 #if defined(ENABLE_CONFIGURATION_POLICY)
82 #include "chrome/browser/policy/cloud/policy_header_service_factory.h"
83 #include "chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.h"
84 #include "chrome/browser/policy/schema_registry_service_factory.h"
85 #if defined(OS_CHROMEOS)
86 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
87 #include "chrome/browser/chromeos/policy/consumer_enrollment_handler_factory.h"
88 #include "chrome/browser/chromeos/policy/consumer_management_notifier_factory.h"
89 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
90 #include "chrome/browser/chromeos/policy/recommendation_restorer_factory.h"
91 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h"
92 #include "chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder_factory.h"
93 #include "chrome/browser/chromeos/policy/user_network_configuration_updater_factory.h"
94 #else
95 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
96 #if !defined(OS_IOS)
97 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
98 #endif
99 #endif
100 #endif
102 #if defined(ENABLE_SUPERVISED_USERS)
103 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_factory.h"
104 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
105 #if defined(OS_CHROMEOS)
106 #include "chrome/browser/supervised_user/chromeos/manager_password_service_factory.h"
107 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_service_factory.h"
108 #endif
109 #endif
111 #if defined(USE_AURA)
112 #include "chrome/browser/ui/gesture_prefs_observer_factory_aura.h"
113 #endif
115 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
116 #include "chrome/browser/media/protected_media_identifier_permission_context_factory.h"
117 #endif
119 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
120 #include "chrome/browser/signin/cross_device_promo_factory.h"
121 #endif
123 #if defined(OS_CHROMEOS)
124 #include "chrome/browser/chromeos/printer_detector/printer_detector_factory.h"
125 #include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h"
126 #endif
128 #if !defined(OS_ANDROID)
129 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
130 #endif
132 #if defined(ENABLE_SPELLCHECK)
133 #include "chrome/browser/spellchecker/spellcheck_factory.h"
134 #endif
136 #if defined(ENABLE_SERVICE_DISCOVERY)
137 #include "chrome/browser/local_discovery/privet_notifications_factory.h"
138 #endif
140 namespace chrome {
142 void AddProfilesExtraParts(ChromeBrowserMainParts* main_parts) {
143 main_parts->AddParts(new ChromeBrowserMainExtraPartsProfiles());
146 } // namespace chrome
148 ChromeBrowserMainExtraPartsProfiles::ChromeBrowserMainExtraPartsProfiles() {
151 ChromeBrowserMainExtraPartsProfiles::~ChromeBrowserMainExtraPartsProfiles() {
154 // This method gets the instance of each ServiceFactory. We do this so that
155 // each ServiceFactory initializes itself and registers its dependencies with
156 // the global PreferenceDependencyManager. We need to have a complete
157 // dependency graph when we create a profile so we can dispatch the profile
158 // creation message to the services that want to create their services at
159 // profile creation time.
161 // TODO(erg): This needs to be something else. I don't think putting every
162 // FooServiceFactory here will scale or is desirable long term.
164 // static
165 void ChromeBrowserMainExtraPartsProfiles::
166 EnsureBrowserContextKeyedServiceFactoriesBuilt() {
167 #if defined(ENABLE_EXTENSIONS)
168 apps::EnsureBrowserContextKeyedServiceFactoriesBuilt();
169 extensions::EnsureBrowserContextKeyedServiceFactoriesBuilt();
170 extensions::ExtensionManagementFactory::GetInstance();
171 chrome_extensions::EnsureBrowserContextKeyedServiceFactoriesBuilt();
172 AppShortcutManagerFactory::GetInstance();
173 EphemeralAppServiceFactory::GetInstance();
174 #endif
176 #if defined(ENABLE_APP_LIST)
177 app_list::AppListSyncableServiceFactory::GetInstance();
178 #endif
180 AboutSigninInternalsFactory::GetInstance();
181 AccountTrackerServiceFactory::GetInstance();
182 AccountFetcherServiceFactory::GetInstance();
183 autofill::PersonalDataManagerFactory::GetInstance();
184 #if !defined(OS_ANDROID)
185 AutomaticProfileResetterFactory::GetInstance();
186 #endif
187 #if defined(ENABLE_BACKGROUND)
188 BackgroundContentsServiceFactory::GetInstance();
189 #endif
190 BookmarkModelFactory::GetInstance();
191 BookmarkUndoServiceFactory::GetInstance();
192 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
193 CaptivePortalServiceFactory::GetInstance();
194 #endif
195 GeolocationPermissionContextFactory::GetInstance();
196 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
197 ProtectedMediaIdentifierPermissionContextFactory::GetInstance();
198 #endif
199 #if defined(ENABLE_PRINT_PREVIEW)
200 CloudPrintProxyServiceFactory::GetInstance();
201 #endif
202 CookieSettingsFactory::GetInstance();
203 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
204 CrossDevicePromoFactory::GetInstance();
205 #endif
206 #if defined(ENABLE_NOTIFICATIONS)
207 #if defined(ENABLE_EXTENSIONS)
208 ExtensionWelcomeNotificationFactory::GetInstance();
209 #endif
210 NotificationPermissionContextFactory::GetInstance();
211 NotifierStateTrackerFactory::GetInstance();
212 #endif // defined(ENABLE_NOTIFICATIONS)
213 dom_distiller::DomDistillerServiceFactory::GetInstance();
214 domain_reliability::DomainReliabilityServiceFactory::GetInstance();
215 DownloadServiceFactory::GetInstance();
216 #if defined(ENABLE_EXTENSIONS)
217 EasyUnlockServiceFactory::GetInstance();
218 EnhancedBookmarkKeyServiceFactory::GetInstance();
219 #endif
220 #if defined(OS_CHROMEOS)
221 chromeos::PrinterDetectorFactory::GetInstance();
222 extensions::VerifyTrustAPI::GetFactoryInstance();
223 #endif
224 FaviconServiceFactory::GetInstance();
225 FindBarStateFactory::GetInstance();
226 GAIAInfoUpdateServiceFactory::GetInstance();
227 #if defined(USE_AURA)
228 GesturePrefsObserverFactoryAura::GetInstance();
229 #endif
230 GlobalErrorServiceFactory::GetInstance();
231 GoogleURLTrackerFactory::GetInstance();
232 HistoryServiceFactory::GetInstance();
233 #if defined(ENABLE_EXTENSIONS)
234 HotwordServiceFactory::GetInstance();
235 #endif
236 InMemoryURLIndexFactory::GetInstance();
237 invalidation::ProfileInvalidationProviderFactory::GetInstance();
238 InstantServiceFactory::GetInstance();
239 #if defined(ENABLE_SERVICE_DISCOVERY)
240 local_discovery::PrivetNotificationServiceFactory::GetInstance();
241 #endif
242 #if defined(ENABLE_SUPERVISED_USERS)
243 #if defined(OS_CHROMEOS)
244 chromeos::SupervisedUserPasswordServiceFactory::GetInstance();
245 chromeos::ManagerPasswordServiceFactory::GetInstance();
246 #endif
247 SupervisedUserServiceFactory::GetInstance();
248 #if !defined(OS_ANDROID) && !defined(OS_IOS)
249 SupervisedUserSyncServiceFactory::GetInstance();
250 #endif
251 #endif
252 #if defined(ENABLE_EXTENSIONS)
253 #if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_MACOSX)
254 scoped_ptr<extensions::NetworkingPrivateVerifyDelegateFactoryImpl>
255 networking_private_verify_delegate_factory(
256 new extensions::NetworkingPrivateVerifyDelegateFactoryImpl);
257 extensions::NetworkingPrivateDelegateFactory::GetInstance()
258 ->SetVerifyDelegateFactory(
259 networking_private_verify_delegate_factory.Pass());
260 scoped_ptr<extensions::NetworkingPrivateUIDelegateFactoryImpl>
261 networking_private_ui_delegate_factory(
262 new extensions::NetworkingPrivateUIDelegateFactoryImpl);
263 extensions::NetworkingPrivateDelegateFactory::GetInstance()
264 ->SetUIDelegateFactory(networking_private_ui_delegate_factory.Pass());
265 #endif
266 #endif
267 #if !defined(OS_ANDROID)
268 MediaGalleriesPreferencesFactory::GetInstance();
269 NTPResourceCacheFactory::GetInstance();
270 #endif
271 PasswordStoreFactory::GetInstance();
272 #if !defined(OS_ANDROID)
273 PinnedTabServiceFactory::GetInstance();
274 #endif
275 #if defined(ENABLE_PLUGINS)
276 PluginPrefsFactory::GetInstance();
277 #endif
278 PrefsTabHelper::GetServiceInstance();
279 policy::ProfilePolicyConnectorFactory::GetInstance();
280 #if defined(ENABLE_CONFIGURATION_POLICY)
281 #if defined(OS_CHROMEOS)
282 chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance();
283 policy::ConsumerEnrollmentHandlerFactory::GetInstance();
284 policy::ConsumerManagementNotifierFactory::GetInstance();
285 policy::PolicyCertServiceFactory::GetInstance();
286 policy::RecommendationRestorerFactory::GetInstance();
287 policy::UserCloudPolicyManagerFactoryChromeOS::GetInstance();
288 policy::UserCloudPolicyTokenForwarderFactory::GetInstance();
289 policy::UserNetworkConfigurationUpdaterFactory::GetInstance();
290 #else
291 policy::UserCloudPolicyManagerFactory::GetInstance();
292 #if !defined(OS_IOS)
293 policy::UserPolicySigninServiceFactory::GetInstance();
294 #endif
295 #endif
296 policy::PolicyHeaderServiceFactory::GetInstance();
297 policy::SchemaRegistryServiceFactory::GetInstance();
298 policy::UserCloudPolicyInvalidatorFactory::GetInstance();
299 #endif
300 predictors::AutocompleteActionPredictorFactory::GetInstance();
301 predictors::PredictorDatabaseFactory::GetInstance();
302 predictors::ResourcePrefetchPredictorFactory::GetInstance();
303 prerender::PrerenderLinkManagerFactory::GetInstance();
304 prerender::PrerenderManagerFactory::GetInstance();
305 prerender::PrerenderMessageFilter::EnsureShutdownNotifierFactoryBuilt();
306 ProfileSyncServiceFactory::GetInstance();
307 ProtocolHandlerRegistryFactory::GetInstance();
308 #if defined(ENABLE_SESSION_SERVICE)
309 SessionServiceFactory::GetInstance();
310 #endif
311 ShortcutsBackendFactory::GetInstance();
312 SigninManagerFactory::GetInstance();
314 if (SiteEngagementService::IsEnabled())
315 SiteEngagementServiceFactory::GetInstance();
317 #if defined(ENABLE_SPELLCHECK)
318 SpellcheckServiceFactory::GetInstance();
319 #endif
320 suggestions::SuggestionsServiceFactory::GetInstance();
321 ThumbnailServiceFactory::GetInstance();
322 TabRestoreServiceFactory::GetInstance();
323 TemplateURLFetcherFactory::GetInstance();
324 TemplateURLServiceFactory::GetInstance();
325 #if defined(ENABLE_THEMES)
326 ThemeServiceFactory::GetInstance();
327 #endif
328 WebDataServiceFactory::GetInstance();
331 void ChromeBrowserMainExtraPartsProfiles::PreProfileInit() {
332 EnsureBrowserContextKeyedServiceFactoriesBuilt();