Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6282)

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 11572036: Do not load extension system in the Profile import process. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rollback to patchset 10 Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 535a3a4731b60ef2996e299871b46959fa94c0a7..17334269f3bc563f475bddc93cc41bbe3255b850 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -69,6 +69,8 @@ using content::UserMetricsAction;
namespace {
+static bool did_perform_profile_import = false;
+
// Profiles that should be deleted on shutdown.
std::vector<FilePath>& ProfilesToDelete() {
CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ());
@@ -631,12 +633,24 @@ void ProfileManager::Observe(
}
}
+// static
+bool ProfileManager::IsImportProcess(const CommandLine& command_line) {
+ return (command_line.HasSwitch(switches::kImport) ||
+ command_line.HasSwitch(switches::kImportFromFile));
+}
+
+// static
+bool ProfileManager::DidPerformProfileImport() {
+ return did_perform_profile_import;
+}
+
void ProfileManager::SetWillImport() {
will_import_ = true;
}
void ProfileManager::OnImportFinished(Profile* profile) {
will_import_ = false;
+ did_perform_profile_import = true;
DCHECK(profile);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_IMPORT_FINISHED,
@@ -700,13 +714,15 @@ void ProfileManager::DoFinalInitForServices(Profile* profile,
bool go_off_the_record) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
#if defined(ENABLE_EXTENSIONS)
- extensions::ExtensionSystem::Get(profile)->InitForRegularProfile(
- !go_off_the_record);
- // During tests, when |profile| is an instance of TestingProfile,
- // ExtensionSystem might not create an ExtensionService.
- if (extensions::ExtensionSystem::Get(profile)->extension_service()) {
- profile->GetHostContentSettingsMap()->RegisterExtensionService(
- extensions::ExtensionSystem::Get(profile)->extension_service());
+ if (!IsImportProcess(command_line)) {
+ extensions::ExtensionSystem::Get(profile)->InitForRegularProfile(
+ !go_off_the_record);
+ // During tests, when |profile| is an instance of TestingProfile,
+ // ExtensionSystem might not create an ExtensionService.
+ if (extensions::ExtensionSystem::Get(profile)->extension_service()) {
+ profile->GetHostContentSettingsMap()->RegisterExtensionService(
+ extensions::ExtensionSystem::Get(profile)->extension_service());
+ }
}
#endif
if (!command_line.HasSwitch(switches::kDisableWebResources))
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698