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