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