| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/profiles/profile_dependency_manager.h" | 5 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 | 10 |
| 11 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 11 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 12 #include "chrome/browser/background/background_contents_service_factory.h" | 12 #include "chrome/browser/background/background_contents_service_factory.h" |
| 13 #include "chrome/browser/content_settings/cookie_settings.h" | 13 #include "chrome/browser/content_settings/cookie_settings.h" |
| 14 #include "chrome/browser/extensions/speech_input/extension_speech_input_manager.
h" | |
| 15 #include "chrome/browser/plugin_prefs_factory.h" | 14 #include "chrome/browser/plugin_prefs_factory.h" |
| 16 #include "chrome/browser/prerender/prerender_manager_factory.h" | 15 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 17 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 16 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_keyed_service.h" | 18 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 20 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 19 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
| 21 #include "chrome/browser/search_engines/template_url_service_factory.h" | 20 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 22 #include "chrome/browser/sessions/session_service_factory.h" | 21 #include "chrome/browser/sessions/session_service_factory.h" |
| 23 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 22 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 23 #include "chrome/browser/speech/speech_input_extension_manager.h" |
| 24 | 24 |
| 25 class Profile; | 25 class Profile; |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 bool g_initialized = false; | 29 bool g_initialized = false; |
| 30 | 30 |
| 31 // This method gets the instance of each ServiceFactory. We do this so that | 31 // This method gets the instance of each ServiceFactory. We do this so that |
| 32 // each ServiceFactory initializes iteslf and registers its dependencies with | 32 // each ServiceFactory initializes iteslf and registers its dependencies with |
| 33 // the global PreferenceDependencyManager. We need to have a complete | 33 // the global PreferenceDependencyManager. We need to have a complete |
| 34 // dependency graph when we create a profile so we can dispatch the profile | 34 // dependency graph when we create a profile so we can dispatch the profile |
| 35 // creation message to the services that want to create their services at | 35 // creation message to the services that want to create their services at |
| 36 // profile creation time. | 36 // profile creation time. |
| 37 // | 37 // |
| 38 // TODO(erg): This needs to be something else. I don't think putting every | 38 // TODO(erg): This needs to be something else. I don't think putting every |
| 39 // FooServiceFactory here will scale or is desireable long term. | 39 // FooServiceFactory here will scale or is desireable long term. |
| 40 void AssertFactoriesBuilt() { | 40 void AssertFactoriesBuilt() { |
| 41 if (!g_initialized) { | 41 if (!g_initialized) { |
| 42 BackgroundContentsServiceFactory::GetInstance(); | 42 BackgroundContentsServiceFactory::GetInstance(); |
| 43 CloudPrintProxyServiceFactory::GetInstance(); | 43 CloudPrintProxyServiceFactory::GetInstance(); |
| 44 CookieSettings::Factory::GetInstance(); | 44 CookieSettings::Factory::GetInstance(); |
| 45 ExtensionSpeechInputManager::InitializeFactory(); | 45 SpeechInputExtensionManager::InitializeFactory(); |
| 46 PersonalDataManagerFactory::GetInstance(); | 46 PersonalDataManagerFactory::GetInstance(); |
| 47 PluginPrefsFactory::GetInstance(); | 47 PluginPrefsFactory::GetInstance(); |
| 48 prerender::PrerenderManagerFactory::GetInstance(); | 48 prerender::PrerenderManagerFactory::GetInstance(); |
| 49 SessionServiceFactory::GetInstance(); | 49 SessionServiceFactory::GetInstance(); |
| 50 TabRestoreServiceFactory::GetInstance(); | 50 TabRestoreServiceFactory::GetInstance(); |
| 51 TemplateURLServiceFactory::GetInstance(); | 51 TemplateURLServiceFactory::GetInstance(); |
| 52 | 52 |
| 53 g_initialized = true; | 53 g_initialized = true; |
| 54 } | 54 } |
| 55 } | 55 } |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 if (edges.size()) { | 209 if (edges.size()) { |
| 210 NOTREACHED() << "Dependency graph has a cycle. We are doomed."; | 210 NOTREACHED() << "Dependency graph has a cycle. We are doomed."; |
| 211 } | 211 } |
| 212 | 212 |
| 213 std::reverse(output.begin(), output.end()); | 213 std::reverse(output.begin(), output.end()); |
| 214 destruction_order_ = output; | 214 destruction_order_ = output; |
| 215 } | 215 } |
| OLD | NEW |