| 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 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/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 19 #include "chrome/browser/extensions/default_apps_trial.h" | 20 #include "chrome/browser/extensions/default_apps_trial.h" |
| 20 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
| 21 #include "chrome/browser/extensions/extension_system.h" | 22 #include "chrome/browser/extensions/extension_system.h" |
| 22 #include "chrome/browser/managed_mode.h" | 23 #include "chrome/browser/managed_mode.h" |
| 23 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
| 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 25 #include "chrome/browser/prefs/scoped_user_pref_update.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" |
| 28 #include "chrome/browser/sessions/session_service_factory.h" | 29 #include "chrome/browser/sessions/session_service_factory.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 chrome::NOTIFICATION_PROFILE_ADDED, | 642 chrome::NOTIFICATION_PROFILE_ADDED, |
| 642 content::Source<Profile>(profile), | 643 content::Source<Profile>(profile), |
| 643 content::NotificationService::NoDetails()); | 644 content::NotificationService::NoDetails()); |
| 644 | 645 |
| 645 } | 646 } |
| 646 | 647 |
| 647 void ProfileManager::DoFinalInitForServices(Profile* profile, | 648 void ProfileManager::DoFinalInitForServices(Profile* profile, |
| 648 bool go_off_the_record) { | 649 bool go_off_the_record) { |
| 649 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 650 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 650 ExtensionSystem::Get(profile)->Init(!go_off_the_record); | 651 ExtensionSystem::Get(profile)->Init(!go_off_the_record); |
| 652 // During tests, when |profile| is an instance of TestingProfile, |
| 653 // ExtensionSystem might not create an ExtensionService. |
| 654 if (ExtensionSystem::Get(profile)->extension_service()) { |
| 655 profile->GetHostContentSettingsMap()->RegisterExtensionService( |
| 656 ExtensionSystem::Get(profile)->extension_service()); |
| 657 } |
| 651 if (!command_line.HasSwitch(switches::kDisableWebResources)) | 658 if (!command_line.HasSwitch(switches::kDisableWebResources)) |
| 652 profile->InitPromoResources(); | 659 profile->InitPromoResources(); |
| 653 } | 660 } |
| 654 | 661 |
| 655 void ProfileManager::DoFinalInitLogging(Profile* profile) { | 662 void ProfileManager::DoFinalInitLogging(Profile* profile) { |
| 656 // Count number of extensions in this profile. | 663 // Count number of extensions in this profile. |
| 657 int extension_count = -1; | 664 int extension_count = -1; |
| 658 ExtensionService* extension_service = profile->GetExtensionService(); | 665 ExtensionService* extension_service = profile->GetExtensionService(); |
| 659 if (extension_service) | 666 if (extension_service) |
| 660 extension_count = extension_service->GetAppIds().size(); | 667 extension_count = extension_service->GetAppIds().size(); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 986 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| 980 Profile* profile, | 987 Profile* profile, |
| 981 Profile::CreateStatus status) { | 988 Profile::CreateStatus status) { |
| 982 for (size_t i = 0; i < callbacks.size(); ++i) | 989 for (size_t i = 0; i < callbacks.size(); ++i) |
| 983 callbacks[i].Run(profile, status); | 990 callbacks[i].Run(profile, status); |
| 984 } | 991 } |
| 985 | 992 |
| 986 ProfileManager::ProfileInfo::~ProfileInfo() { | 993 ProfileManager::ProfileInfo::~ProfileInfo() { |
| 987 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 994 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
| 988 } | 995 } |
| OLD | NEW |