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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 #include "components/signin/core/browser/account_tracker_service.h" | 80 #include "components/signin/core/browser/account_tracker_service.h" |
81 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 81 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
82 #include "components/signin/core/browser/signin_manager.h" | 82 #include "components/signin/core/browser/signin_manager.h" |
83 #include "components/signin/core/common/profile_management_switches.h" | 83 #include "components/signin/core/common/profile_management_switches.h" |
84 #include "components/signin/core/common/signin_pref_names.h" | 84 #include "components/signin/core/common/signin_pref_names.h" |
85 #include "components/sync/base/stop_source.h" | 85 #include "components/sync/base/stop_source.h" |
86 #include "content/public/browser/browser_thread.h" | 86 #include "content/public/browser/browser_thread.h" |
87 #include "content/public/browser/notification_service.h" | 87 #include "content/public/browser/notification_service.h" |
88 #include "content/public/browser/user_metrics.h" | 88 #include "content/public/browser/user_metrics.h" |
89 #include "content/public/common/content_switches.h" | 89 #include "content/public/common/content_switches.h" |
| 90 #include "extensions/features/features.h" |
90 #include "net/http/http_transaction_factory.h" | 91 #include "net/http/http_transaction_factory.h" |
91 #include "net/url_request/url_request_context.h" | 92 #include "net/url_request/url_request_context.h" |
92 #include "net/url_request/url_request_context_getter.h" | 93 #include "net/url_request/url_request_context_getter.h" |
93 #include "net/url_request/url_request_job.h" | 94 #include "net/url_request/url_request_job.h" |
94 #include "ui/base/l10n/l10n_util.h" | 95 #include "ui/base/l10n/l10n_util.h" |
95 | 96 |
96 #if defined(ENABLE_EXTENSIONS) | 97 #if BUILDFLAG(ENABLE_EXTENSIONS) |
97 #include "chrome/browser/extensions/extension_service.h" | 98 #include "chrome/browser/extensions/extension_service.h" |
98 #include "extensions/browser/extension_registry.h" | 99 #include "extensions/browser/extension_registry.h" |
99 #include "extensions/browser/extension_system.h" | 100 #include "extensions/browser/extension_system.h" |
100 #include "extensions/common/extension_set.h" | 101 #include "extensions/common/extension_set.h" |
101 #include "extensions/common/manifest.h" | 102 #include "extensions/common/manifest.h" |
102 #endif | 103 #endif |
103 | 104 |
104 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 105 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
105 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" | 106 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" |
106 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa
ctory.h" | 107 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa
ctory.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { | 259 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { |
259 LOG(ERROR) << "IsMounted call failed."; | 260 LOG(ERROR) << "IsMounted call failed."; |
260 return; | 261 return; |
261 } | 262 } |
262 if (!is_mounted) | 263 if (!is_mounted) |
263 LOG(ERROR) << "Cryptohome is not mounted."; | 264 LOG(ERROR) << "Cryptohome is not mounted."; |
264 } | 265 } |
265 | 266 |
266 #endif | 267 #endif |
267 | 268 |
268 #if defined(ENABLE_EXTENSIONS) | 269 #if BUILDFLAG(ENABLE_EXTENSIONS) |
269 | 270 |
270 // Returns the number of installed (and enabled) apps, excluding any component | 271 // Returns the number of installed (and enabled) apps, excluding any component |
271 // apps. | 272 // apps. |
272 size_t GetEnabledAppCount(Profile* profile) { | 273 size_t GetEnabledAppCount(Profile* profile) { |
273 size_t installed_apps = 0u; | 274 size_t installed_apps = 0u; |
274 const extensions::ExtensionSet& extensions = | 275 const extensions::ExtensionSet& extensions = |
275 extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); | 276 extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); |
276 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); | 277 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); |
277 iter != extensions.end(); | 278 iter != extensions.end(); |
278 ++iter) { | 279 ++iter) { |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 ProfileStatisticsFactory::GetForProfile(profile)->GatherStatistics( | 1120 ProfileStatisticsFactory::GetForProfile(profile)->GatherStatistics( |
1120 profiles::ProfileStatisticsCallback()); | 1121 profiles::ProfileStatisticsCallback()); |
1121 } | 1122 } |
1122 #endif | 1123 #endif |
1123 } | 1124 } |
1124 | 1125 |
1125 void ProfileManager::DoFinalInitForServices(Profile* profile, | 1126 void ProfileManager::DoFinalInitForServices(Profile* profile, |
1126 bool go_off_the_record) { | 1127 bool go_off_the_record) { |
1127 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices"); | 1128 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices"); |
1128 | 1129 |
1129 #if defined(ENABLE_EXTENSIONS) | 1130 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1130 // Ensure that the HostContentSettingsMap has been created before the | 1131 // Ensure that the HostContentSettingsMap has been created before the |
1131 // ExtensionSystem is initialized otherwise the ExtensionSystem will be | 1132 // ExtensionSystem is initialized otherwise the ExtensionSystem will be |
1132 // registered twice | 1133 // registered twice |
1133 HostContentSettingsMap* content_settings_map = | 1134 HostContentSettingsMap* content_settings_map = |
1134 HostContentSettingsMapFactory::GetForProfile(profile); | 1135 HostContentSettingsMapFactory::GetForProfile(profile); |
1135 | 1136 |
1136 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile( | 1137 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile( |
1137 !go_off_the_record); | 1138 !go_off_the_record); |
1138 // During tests, when |profile| is an instance of TestingProfile, | 1139 // During tests, when |profile| is an instance of TestingProfile, |
1139 // ExtensionSystem might not create an ExtensionService. | 1140 // ExtensionSystem might not create an ExtensionService. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 #if defined(OS_ANDROID) | 1203 #if defined(OS_ANDROID) |
1203 // Service is responsible for fetching content snippets for the NTP. | 1204 // Service is responsible for fetching content snippets for the NTP. |
1204 ContentSuggestionsServiceFactory::GetForProfile(profile); | 1205 ContentSuggestionsServiceFactory::GetForProfile(profile); |
1205 #endif | 1206 #endif |
1206 } | 1207 } |
1207 | 1208 |
1208 void ProfileManager::DoFinalInitLogging(Profile* profile) { | 1209 void ProfileManager::DoFinalInitLogging(Profile* profile) { |
1209 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitLogging"); | 1210 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitLogging"); |
1210 // Count number of extensions in this profile. | 1211 // Count number of extensions in this profile. |
1211 int enabled_app_count = -1; | 1212 int enabled_app_count = -1; |
1212 #if defined(ENABLE_EXTENSIONS) | 1213 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1213 enabled_app_count = GetEnabledAppCount(profile); | 1214 enabled_app_count = GetEnabledAppCount(profile); |
1214 #endif | 1215 #endif |
1215 | 1216 |
1216 // Log the profile size after a reasonable startup delay. | 1217 // Log the profile size after a reasonable startup delay. |
1217 BrowserThread::PostDelayedTask( | 1218 BrowserThread::PostDelayedTask( |
1218 BrowserThread::FILE, FROM_HERE, | 1219 BrowserThread::FILE, FROM_HERE, |
1219 base::Bind(&ProfileSizeTask, profile->GetPath(), enabled_app_count), | 1220 base::Bind(&ProfileSizeTask, profile->GetPath(), enabled_app_count), |
1220 base::TimeDelta::FromSeconds(112)); | 1221 base::TimeDelta::FromSeconds(112)); |
1221 } | 1222 } |
1222 | 1223 |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 | 1669 |
1669 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); | 1670 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); |
1670 if (!original_callback.is_null()) | 1671 if (!original_callback.is_null()) |
1671 original_callback.Run(loaded_profile, status); | 1672 original_callback.Run(loaded_profile, status); |
1672 } | 1673 } |
1673 #endif // !defined(OS_ANDROID) | 1674 #endif // !defined(OS_ANDROID) |
1674 | 1675 |
1675 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1676 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1676 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1677 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1677 } | 1678 } |
OLD | NEW |