Chromium Code Reviews| Index: chrome/browser/extensions/extension_service.cc |
| diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc |
| index 0a3c1bd9f78f75a8350e9a7e3fcd7181beb6bf58..3838a3b61b968dd099ccf4d552f46d960aea365d 100644 |
| --- a/chrome/browser/extensions/extension_service.cc |
| +++ b/chrome/browser/extensions/extension_service.cc |
| @@ -412,11 +412,9 @@ ExtensionService::ExtensionService(Profile* profile, |
| app_notification_manager_->Init(); |
| if (extensions_enabled_) { |
| - if (!command_line->HasSwitch(switches::kImport) && |
| - !command_line->HasSwitch(switches::kImportFromFile)) { |
| - extensions::ExternalProviderImpl::CreateExternalProviders( |
| - this, profile_, &external_extension_providers_); |
| - } |
| + CHECK(!ProfileManager::IsImportProcess(*command_line)); |
| + extensions::ExternalProviderImpl::CreateExternalProviders( |
| + this, profile_, &external_extension_providers_); |
| } |
| // Set this as the ExtensionService for extension sorting to ensure it |
| @@ -504,6 +502,8 @@ void ExtensionService::RegisterForImportFinished() { |
| } |
| void ExtensionService::InitAfterImport() { |
| + component_loader_->LoadAllDeferred(); |
| + |
| CheckForExternalUpdates(); |
| GarbageCollectExtensions(); |
| @@ -591,10 +591,29 @@ void ExtensionService::Init() { |
| DCHECK(!ready_); // Can't redo init. |
| DCHECK_EQ(extensions_.size(), 0u); |
| + CHECK(!ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess())); |
| + |
| // TODO(mek): It might be cleaner to do the FinishDelayedInstallInfo stuff |
| // here instead of in installedloader. |
| - component_loader_->LoadAll(); |
| - extensions::InstalledLoader(this).LoadAllExtensions(); |
| + if (g_browser_process->profile_manager() && |
| + g_browser_process->profile_manager()->will_import()) { |
| + |
| + // Defer extensions with background pages, since they may conflict with the |
| + // import process. |
| + component_loader_->LoadAll(true); |
| + extensions::InstalledLoader(this).LoadAllExtensions(); |
|
tapted
2012/12/19 13:19:14
a question raised from this line might be, "what a
Yoyo Zhou
2012/12/19 21:50:38
If non-component extensions are not being deferred
tapted
2012/12/19 22:58:24
Done.
|
| + RegisterForImportFinished(); |
| + } else { |
| + component_loader_->LoadAll(false); |
| + extensions::InstalledLoader(this).LoadAllExtensions(); |
| + |
| + // TODO(erikkay) this should probably be deferred to a future point |
| + // rather than running immediately at startup. |
| + CheckForExternalUpdates(); |
| + |
| + // TODO(erikkay) this should probably be deferred as well. |
| + GarbageCollectExtensions(); |
| + } |
| // The Sideload Wipeout effort takes place during load (see above), so once |
| // that is done the flag can be set so that we don't have to check again. |
| @@ -603,26 +622,6 @@ void ExtensionService::Init() { |
| wipeout_is_active_ = false; // Wipeout is only on during load. |
| } |
| - // If we are running in the import process, don't bother initializing the |
| - // extension service since this can interfere with the main browser process |
| - // that is already running an extension service for this profile. |
| - // TODO(aa): can we start up even less of ExtensionService? |
| - // http://crbug.com/107636 |
| - if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kImport) && |
| - !CommandLine::ForCurrentProcess()->HasSwitch(switches::kImportFromFile)) { |
| - if (g_browser_process->profile_manager() && |
| - g_browser_process->profile_manager()->will_import()) { |
| - RegisterForImportFinished(); |
| - } else { |
| - // TODO(erikkay) this should probably be deferred to a future point |
| - // rather than running immediately at startup. |
| - CheckForExternalUpdates(); |
| - |
| - // TODO(erikkay) this should probably be deferred as well. |
| - GarbageCollectExtensions(); |
| - } |
| - } |
| - |
| if (extension_prefs_->NeedsStorageGarbageCollection()) { |
| GarbageCollectIsolatedStorage(); |
| extension_prefs_->SetNeedsStorageGarbageCollection(false); |
| @@ -2015,7 +2014,7 @@ void ExtensionService::UnloadAllExtensions() { |
| void ExtensionService::ReloadExtensions() { |
| UnloadAllExtensions(); |
| - component_loader_->LoadAll(); |
| + component_loader_->LoadAll(false); |
| extensions::InstalledLoader(this).LoadAllExtensions(); |
| } |