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