Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / ios / chrome / browser / browser_state / browser_state_keyed_service_factories.mm
blob32e375b8074a1d3f6c4703ed956065486682ebd2
1 // Copyright 2015 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 "ios/chrome/browser/browser_state/browser_state_keyed_service_factories.h"
7 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h"
8 #include "ios/chrome/browser/bookmarks/bookmark_client_factory.h"
9 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
10 #include "ios/chrome/browser/bookmarks/startup_task_runner_service_factory.h"
11 #include "ios/chrome/browser/content_settings/cookie_settings_factory.h"
12 #include "ios/chrome/browser/dom_distiller/dom_distiller_service_factory.h"
13 #include "ios/chrome/browser/enhanced_bookmarks/bookmark_image_service_factory.h"
14 #include "ios/chrome/browser/enhanced_bookmarks/bookmark_server_cluster_service_factory.h"
15 #include "ios/chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h"
16 #include "ios/chrome/browser/favicon/favicon_service_factory.h"
17 #include "ios/chrome/browser/google/google_url_tracker_factory.h"
18 #include "ios/chrome/browser/history/history_service_factory.h"
19 #include "ios/chrome/browser/history/top_sites_factory.h"
20 #include "ios/chrome/browser/history/web_history_service_factory.h"
21 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
22 #include "ios/chrome/browser/signin/about_signin_internals_factory.h"
23 #include "ios/chrome/browser/signin/account_fetcher_service_factory.h"
24 #include "ios/chrome/browser/signin/account_reconcilor_factory.h"
25 #include "ios/chrome/browser/signin/account_tracker_service_factory.h"
26 #include "ios/chrome/browser/signin/gaia_cookie_manager_service_factory.h"
27 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
28 #include "ios/chrome/browser/signin/signin_client_factory.h"
29 #include "ios/chrome/browser/signin/signin_error_controller_factory.h"
30 #include "ios/chrome/browser/signin/signin_manager_factory.h"
31 #include "ios/chrome/browser/suggestions/suggestions_service_factory.h"
32 #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
33 #include "ios/chrome/browser/translate/translate_accept_languages_factory.h"
34 #include "ios/chrome/browser/undo/bookmark_undo_service_factory.h"
35 #include "ios/chrome/browser/web_data_service_factory.h"
36 #include "ios/public/provider/chrome/browser/keyed_service_provider.h"
38 // This method gets the instance of each ServiceFactory. We do this so that
39 // each ServiceFactory initializes itself and registers its dependencies with
40 // the global PreferenceDependencyManager. We need to have a complete
41 // dependency graph when we create a browser state so we can dispatch the
42 // browser state creation message to the services that want to create their
43 // services at browser state creation time.
45 // TODO(erg): This needs to be something else. I don't think putting every
46 // FooServiceFactory here will scale or is desirable long term.
47 void EnsureBrowserStateKeyedServiceFactoriesBuilt() {
48   BookmarkClientFactory::GetInstance();
49   BookmarkImageServiceFactory::GetInstance();
50   dom_distiller::DomDistillerServiceFactory::GetInstance();
51   enhanced_bookmarks::BookmarkServerClusterServiceFactory::GetInstance();
52   enhanced_bookmarks::EnhancedBookmarkModelFactory::GetInstance();
53   ios::AboutSigninInternalsFactory::GetInstance();
54   ios::AccountFetcherServiceFactory::GetInstance();
55   ios::AccountReconcilorFactory::GetInstance();
56   ios::AccountTrackerServiceFactory::GetInstance();
57   ios::BookmarkModelFactory::GetInstance();
58   ios::BookmarkUndoServiceFactory::GetInstance();
59   ios::CookieSettingsFactory::GetInstance();
60   ios::FaviconServiceFactory::GetInstance();
61   ios::GaiaCookieManagerServiceFactory::GetInstance();
62   ios::GoogleURLTrackerFactory::GetInstance();
63   ios::HistoryServiceFactory::GetInstance();
64   ios::SigninErrorControllerFactory::GetInstance();
65   ios::SigninManagerFactory::GetInstance();
66   ios::StartupTaskRunnerServiceFactory::GetInstance();
67   ios::TemplateURLServiceFactory::GetInstance();
68   ios::TopSitesFactory::GetInstance();
69   ios::WebDataServiceFactory::GetInstance();
70   ios::WebHistoryServiceFactory::GetInstance();
71   OAuth2TokenServiceFactory::GetInstance();
72   PersonalDataManagerFactory::GetInstance();
73   SigninClientFactory::GetInstance();
74   suggestions::SuggestionsServiceFactory::GetInstance();
75   SyncSetupServiceFactory::GetInstance();
76   TranslateAcceptLanguagesFactory::GetInstance();
78   if (ios::GetKeyedServiceProvider())
79     ios::GetKeyedServiceProvider()->AssertKeyedFactoriesBuilt();