Defer loading all component extensions in a first_run situation.

The import process triggered by a first run, and the browser process
it forks from, both update $profile/Preferences. Adding any component
extension makes a call to ExtensionSorting::EnsureValidOrdinals, which
does a write to Preferences. If this is done before the import process,
and the import process does not *also* call EnsureValidOrdinals (which
was the case before http://crrev.com/174302 ), then the value written
will get clobbered, leading to an invalid ordinal.

http://crrev.com/174302 added logic to defer loading component
extensions with background pages in a first_run situation. This CL
changes the ExtensionSystem initialization so that all component
extension loading is deferred until the import process has finished.

BUG=167449,163925


Review URL: https://chromiumcodereview.appspot.com/11644095

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174621 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index edb0068..b89c7ab 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -502,7 +502,7 @@
 }
 
 void ExtensionService::InitAfterImport() {
-  component_loader_->BulkLoadDeferred();
+  component_loader_->LoadAll();
 
   CheckForExternalUpdates();
 
@@ -591,14 +591,13 @@
   // here instead of in installedloader.
   if (g_browser_process->profile_manager() &&
       g_browser_process->profile_manager()->will_import()) {
+    // Do not load any component extensions, since they may conflict with the
+    // import process.
 
-    // Defer component extensions with background pages, since they may conflict
-    // with the import process.
-    component_loader_->BulkLoadDeferBackgroundPages();
     extensions::InstalledLoader(this).LoadAllExtensions();
     RegisterForImportFinished();
   } else {
-    component_loader_->BulkLoadAll();
+    component_loader_->LoadAll();
     extensions::InstalledLoader(this).LoadAllExtensions();
 
     // TODO(erikkay) this should probably be deferred to a future point
@@ -1991,7 +1990,7 @@
 
 void ExtensionService::ReloadExtensions() {
   UnloadAllExtensions();
-  component_loader_->BulkLoadAll();
+  component_loader_->LoadAll();
   extensions::InstalledLoader(this).LoadAllExtensions();
 }