chrome_browser_main_extra_parts_profiles.cc revision 5c02ac1a9c1b504631c0a3d2b6e737b5d738bae1
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. 4 5#include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" 6 7#include "chrome/browser/autocomplete/shortcuts_backend_factory.h" 8#include "chrome/browser/autofill/personal_data_manager_factory.h" 9#include "chrome/browser/background/background_contents_service_factory.h" 10#include "chrome/browser/bookmarks/bookmark_model_factory.h" 11#include "chrome/browser/chrome_browser_main.h" 12#include "chrome/browser/content_settings/cookie_settings.h" 13#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 14#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 15#include "chrome/browser/download/download_service_factory.h" 16#include "chrome/browser/favicon/favicon_service_factory.h" 17#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h" 18#include "chrome/browser/google/google_url_tracker_factory.h" 19#include "chrome/browser/history/history_service_factory.h" 20#include "chrome/browser/invalidation/invalidation_service_factory.h" 21#include "chrome/browser/media_galleries/media_galleries_preferences_factory.h" 22#include "chrome/browser/notifications/desktop_notification_service_factory.h" 23#include "chrome/browser/password_manager/password_store_factory.h" 24#include "chrome/browser/plugins/plugin_prefs_factory.h" 25#include "chrome/browser/policy/profile_policy_connector_factory.h" 26#include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" 27#include "chrome/browser/predictors/predictor_database_factory.h" 28#include "chrome/browser/prerender/prerender_link_manager_factory.h" 29#include "chrome/browser/prerender/prerender_manager_factory.h" 30#include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.h" 31#include "chrome/browser/profiles/gaia_info_update_service_factory.h" 32#include "chrome/browser/search/hotword_service_factory.h" 33#include "chrome/browser/search/instant_service_factory.h" 34#include "chrome/browser/search_engines/template_url_fetcher_factory.h" 35#include "chrome/browser/search_engines/template_url_service_factory.h" 36#include "chrome/browser/sessions/session_service_factory.h" 37#include "chrome/browser/sessions/tab_restore_service_factory.h" 38#include "chrome/browser/signin/about_signin_internals_factory.h" 39#include "chrome/browser/signin/signin_manager_factory.h" 40#include "chrome/browser/sync/profile_sync_service_factory.h" 41#include "chrome/browser/themes/theme_service_factory.h" 42#include "chrome/browser/thumbnails/thumbnail_service_factory.h" 43#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" 44#include "chrome/browser/ui/find_bar/find_bar_state_factory.h" 45#include "chrome/browser/ui/global_error/global_error_service_factory.h" 46#include "chrome/browser/ui/tabs/pinned_tab_service_factory.h" 47#include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" 48#include "chrome/browser/undo/bookmark_undo_service_factory.h" 49#include "chrome/browser/webdata/web_data_service_factory.h" 50 51#if defined(ENABLE_EXTENSIONS) 52#include "apps/browser_context_keyed_service_factories.h" 53#include "chrome/browser/apps/ephemeral_app_service_factory.h" 54#include "chrome/browser/apps/shortcut_manager_factory.h" 55#include "chrome/browser/extensions/browser_context_keyed_service_factories.h" 56#include "extensions/browser/browser_context_keyed_service_factories.h" 57#endif 58 59#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 60#include "chrome/browser/captive_portal/captive_portal_service_factory.h" 61#endif 62 63#if defined(ENABLE_CONFIGURATION_POLICY) 64#include "chrome/browser/policy/cloud/policy_header_service_factory.h" 65#include "chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.h" 66#include "chrome/browser/policy/schema_registry_service_factory.h" 67#if defined(OS_CHROMEOS) 68#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" 69#include "chrome/browser/chromeos/policy/recommendation_restorer_factory.h" 70#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h" 71#include "chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder_factory.h" 72#include "chrome/browser/chromeos/policy/user_network_configuration_updater_factory.h" 73#else 74#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" 75#if !defined(OS_IOS) 76#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" 77#endif 78#endif 79#endif 80 81#if defined(ENABLE_MANAGED_USERS) 82#include "chrome/browser/managed_mode/managed_user_service_factory.h" 83#include "chrome/browser/managed_mode/managed_user_sync_service_factory.h" 84#if defined(OS_CHROMEOS) 85#include "chrome/browser/managed_mode/chromeos/managed_user_password_service_factory.h" 86#include "chrome/browser/managed_mode/chromeos/manager_password_service_factory.h" 87#endif 88#endif 89 90#if defined(USE_AURA) 91#include "chrome/browser/ui/gesture_prefs_observer_factory_aura.h" 92#endif 93 94#if defined(OS_ANDROID) 95#include "chrome/browser/media/protected_media_identifier_permission_context_factory.h" 96#else 97#include "chrome/browser/media_galleries/media_galleries_preferences_factory.h" 98#include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_factory.h" 99#include "chrome/browser/notifications/sync_notifier/synced_notification_app_info_service_factory.h" 100#include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" 101#endif 102 103#if defined(ENABLE_SPELLCHECK) 104#include "chrome/browser/spellchecker/spellcheck_factory.h" 105#endif 106 107#if defined(ENABLE_SERVICE_DISCOVERY) 108#include "chrome/browser/local_discovery/privet_notifications_factory.h" 109#endif 110 111namespace chrome { 112 113void AddProfilesExtraParts(ChromeBrowserMainParts* main_parts) { 114 main_parts->AddParts(new ChromeBrowserMainExtraPartsProfiles()); 115} 116 117} // namespace chrome 118 119ChromeBrowserMainExtraPartsProfiles::ChromeBrowserMainExtraPartsProfiles() { 120} 121 122ChromeBrowserMainExtraPartsProfiles::~ChromeBrowserMainExtraPartsProfiles() { 123} 124 125// This method gets the instance of each ServiceFactory. We do this so that 126// each ServiceFactory initializes itself and registers its dependencies with 127// the global PreferenceDependencyManager. We need to have a complete 128// dependency graph when we create a profile so we can dispatch the profile 129// creation message to the services that want to create their services at 130// profile creation time. 131// 132// TODO(erg): This needs to be something else. I don't think putting every 133// FooServiceFactory here will scale or is desirable long term. 134// 135// static 136void ChromeBrowserMainExtraPartsProfiles:: 137EnsureBrowserContextKeyedServiceFactoriesBuilt() { 138#if defined(ENABLE_EXTENSIONS) 139 apps::EnsureBrowserContextKeyedServiceFactoriesBuilt(); 140 extensions::EnsureBrowserContextKeyedServiceFactoriesBuilt(); 141 chrome_extensions::EnsureBrowserContextKeyedServiceFactoriesBuilt(); 142 AppShortcutManagerFactory::GetInstance(); 143 EphemeralAppServiceFactory::GetInstance(); 144#endif 145 146#if defined(ENABLE_APP_LIST) 147 app_list::AppListSyncableServiceFactory::GetInstance(); 148#endif 149 150 AboutSigninInternalsFactory::GetInstance(); 151 autofill::PersonalDataManagerFactory::GetInstance(); 152#if !defined(OS_ANDROID) 153 AutomaticProfileResetterFactory::GetInstance(); 154#endif 155#if defined(ENABLE_BACKGROUND) 156 BackgroundContentsServiceFactory::GetInstance(); 157#endif 158 BookmarkModelFactory::GetInstance(); 159#if !defined(OS_ANDROID) 160 BookmarkUndoServiceFactory::GetInstance(); 161#endif 162#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 163 CaptivePortalServiceFactory::GetInstance(); 164#endif 165 ChromeGeolocationPermissionContextFactory::GetInstance(); 166#if defined(OS_ANDROID) 167 ProtectedMediaIdentifierPermissionContextFactory::GetInstance(); 168#endif 169#if defined(ENABLE_FULL_PRINTING) 170 CloudPrintProxyServiceFactory::GetInstance(); 171#endif 172 CookieSettings::Factory::GetInstance(); 173#if defined(ENABLE_NOTIFICATIONS) 174 DesktopNotificationServiceFactory::GetInstance(); 175#endif 176 dom_distiller::DomDistillerServiceFactory::GetInstance(); 177 DownloadServiceFactory::GetInstance(); 178 FaviconServiceFactory::GetInstance(); 179 FindBarStateFactory::GetInstance(); 180 GAIAInfoUpdateServiceFactory::GetInstance(); 181#if defined(USE_AURA) 182 GesturePrefsObserverFactoryAura::GetInstance(); 183#endif 184 GlobalErrorServiceFactory::GetInstance(); 185 GoogleURLTrackerFactory::GetInstance(); 186 HistoryServiceFactory::GetInstance(); 187 HotwordServiceFactory::GetInstance(); 188 invalidation::InvalidationServiceFactory::GetInstance(); 189 InstantServiceFactory::GetInstance(); 190#if defined(ENABLE_SERVICE_DISCOVERY) 191 local_discovery::PrivetNotificationServiceFactory::GetInstance(); 192#endif 193#if defined(ENABLE_MANAGED_USERS) 194#if defined(OS_CHROMEOS) 195 chromeos::ManagedUserPasswordServiceFactory::GetInstance(); 196 chromeos::ManagerPasswordServiceFactory::GetInstance(); 197#endif 198 ManagedUserServiceFactory::GetInstance(); 199 ManagedUserSyncServiceFactory::GetInstance(); 200#endif 201#if !defined(OS_ANDROID) 202 MediaGalleriesPreferencesFactory::GetInstance(); 203 notifier::ChromeNotifierServiceFactory::GetInstance(); 204 notifier::SyncedNotificationAppInfoServiceFactory::GetInstance(); 205 NTPResourceCacheFactory::GetInstance(); 206#endif 207 PasswordStoreFactory::GetInstance(); 208#if !defined(OS_ANDROID) 209 PinnedTabServiceFactory::GetInstance(); 210#endif 211#if defined(ENABLE_PLUGINS) 212 PluginPrefsFactory::GetInstance(); 213#endif 214 policy::ProfilePolicyConnectorFactory::GetInstance(); 215#if defined(ENABLE_CONFIGURATION_POLICY) 216#if defined(OS_CHROMEOS) 217 policy::PolicyCertServiceFactory::GetInstance(); 218 policy::RecommendationRestorerFactory::GetInstance(); 219 policy::UserCloudPolicyManagerFactoryChromeOS::GetInstance(); 220 policy::UserCloudPolicyTokenForwarderFactory::GetInstance(); 221 policy::UserNetworkConfigurationUpdaterFactory::GetInstance(); 222#else 223 policy::UserCloudPolicyManagerFactory::GetInstance(); 224#if !defined(OS_IOS) 225 policy::UserPolicySigninServiceFactory::GetInstance(); 226#endif 227#endif 228 policy::PolicyHeaderServiceFactory::GetInstance(); 229 policy::SchemaRegistryServiceFactory::GetInstance(); 230 policy::UserCloudPolicyInvalidatorFactory::GetInstance(); 231#endif 232 predictors::AutocompleteActionPredictorFactory::GetInstance(); 233 predictors::PredictorDatabaseFactory::GetInstance(); 234 prerender::PrerenderManagerFactory::GetInstance(); 235 prerender::PrerenderLinkManagerFactory::GetInstance(); 236 ProfileSyncServiceFactory::GetInstance(); 237 ProtocolHandlerRegistryFactory::GetInstance(); 238#if defined(ENABLE_SESSION_SERVICE) 239 SessionServiceFactory::GetInstance(); 240#endif 241 ShortcutsBackendFactory::GetInstance(); 242 SigninManagerFactory::GetInstance(); 243#if defined(ENABLE_SPELLCHECK) 244 SpellcheckServiceFactory::GetInstance(); 245#endif 246 ThumbnailServiceFactory::GetInstance(); 247 TabRestoreServiceFactory::GetInstance(); 248 TemplateURLFetcherFactory::GetInstance(); 249 TemplateURLServiceFactory::GetInstance(); 250#if defined(ENABLE_THEMES) 251 ThemeServiceFactory::GetInstance(); 252#endif 253 WebDataServiceFactory::GetInstance(); 254} 255 256void ChromeBrowserMainExtraPartsProfiles::PreProfileInit() { 257 EnsureBrowserContextKeyedServiceFactoriesBuilt(); 258} 259