OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager.h" | 5 #include "chrome/browser/profiles/profile_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/deferred_sequenced_task_runner.h" |
11 #include "base/file_util.h" | 12 #include "base/file_util.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/prefs/pref_registry_simple.h" | 15 #include "base/prefs/pref_registry_simple.h" |
15 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/bookmarks/bookmark_model.h" | 20 #include "chrome/browser/bookmarks/bookmark_model.h" |
20 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 21 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
21 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/content_settings/host_content_settings_map.h" | 23 #include "chrome/browser/content_settings/host_content_settings_map.h" |
23 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
24 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" | 25 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" |
25 #include "chrome/browser/profiles/profile_destroyer.h" | 26 #include "chrome/browser/profiles/profile_destroyer.h" |
26 #include "chrome/browser/profiles/profile_info_cache.h" | 27 #include "chrome/browser/profiles/profile_info_cache.h" |
27 #include "chrome/browser/profiles/profile_metrics.h" | 28 #include "chrome/browser/profiles/profile_metrics.h" |
| 29 #include "chrome/browser/profiles/startup_task_runner_service.h" |
| 30 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" |
28 #include "chrome/browser/sync/profile_sync_service.h" | 31 #include "chrome/browser/sync/profile_sync_service.h" |
29 #include "chrome/browser/sync/profile_sync_service_factory.h" | 32 #include "chrome/browser/sync/profile_sync_service_factory.h" |
30 #include "chrome/browser/ui/browser.h" | 33 #include "chrome/browser/ui/browser.h" |
31 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 34 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
32 #include "chrome/common/chrome_constants.h" | 35 #include "chrome/common/chrome_constants.h" |
33 #include "chrome/common/chrome_notification_types.h" | 36 #include "chrome/common/chrome_notification_types.h" |
34 #include "chrome/common/chrome_paths_internal.h" | 37 #include "chrome/common/chrome_paths_internal.h" |
35 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/logging_chrome.h" | 39 #include "chrome/common/logging_chrome.h" |
37 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 extensions::ExtensionSystem::Get(profile)->extension_service()); | 843 extensions::ExtensionSystem::Get(profile)->extension_service()); |
841 } | 844 } |
842 } | 845 } |
843 #endif | 846 #endif |
844 #if defined(ENABLE_MANAGED_USERS) | 847 #if defined(ENABLE_MANAGED_USERS) |
845 // Initialization needs to happen after extension system initialization (for | 848 // Initialization needs to happen after extension system initialization (for |
846 // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the | 849 // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the |
847 // initializing the managed flag if necessary). | 850 // initializing the managed flag if necessary). |
848 ManagedUserServiceFactory::GetForProfile(profile)->Init(); | 851 ManagedUserServiceFactory::GetForProfile(profile)->Init(); |
849 #endif | 852 #endif |
| 853 // Start the deferred task runners once the profile is loaded. |
| 854 StartupTaskRunnerServiceFactory::GetForProfile(profile)-> |
| 855 StartDeferredTaskRunners(); |
850 } | 856 } |
851 | 857 |
852 void ProfileManager::DoFinalInitLogging(Profile* profile) { | 858 void ProfileManager::DoFinalInitLogging(Profile* profile) { |
853 // Count number of extensions in this profile. | 859 // Count number of extensions in this profile. |
854 int extension_count = -1; | 860 int extension_count = -1; |
855 #if defined(ENABLE_EXTENSIONS) | 861 #if defined(ENABLE_EXTENSIONS) |
856 ExtensionService* extension_service = profile->GetExtensionService(); | 862 ExtensionService* extension_service = profile->GetExtensionService(); |
857 if (extension_service) | 863 if (extension_service) |
858 extension_count = extension_service->GetAppIds().size(); | 864 extension_count = extension_service->GetAppIds().size(); |
859 #endif | 865 #endif |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 ProfileManager::ProfileInfo::ProfileInfo( | 1197 ProfileManager::ProfileInfo::ProfileInfo( |
1192 Profile* profile, | 1198 Profile* profile, |
1193 bool created) | 1199 bool created) |
1194 : profile(profile), | 1200 : profile(profile), |
1195 created(created) { | 1201 created(created) { |
1196 } | 1202 } |
1197 | 1203 |
1198 ProfileManager::ProfileInfo::~ProfileInfo() { | 1204 ProfileManager::ProfileInfo::~ProfileInfo() { |
1199 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1205 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
1200 } | 1206 } |
OLD | NEW |