Revert order of EXTENSION_LOADED and EXTENSION_INSTALLED notifications back to
the original way (installed then loaded).

I originally switched the order so I could dispatch the onInstalled event, but
doing so in a PostTask is a better solution to that.

BUG=no
TEST=no


Review URL: http://codereview.chromium.org/10274013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134653 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index e2db5c5..8f552df9 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1994,7 +1994,7 @@
       content::NotificationService::NoDetails());
 }
 
-bool ExtensionService::AddExtension(const Extension* extension) {
+void ExtensionService::AddExtension(const Extension* extension) {
   // Ensure extension is deleted unless we transfer ownership.
   scoped_refptr<const Extension> scoped_extension(extension);
 
@@ -2005,7 +2005,7 @@
       !extension->is_theme() &&
       extension->location() != Extension::COMPONENT &&
       !Extension::IsExternalLocation(extension->location()))
-    return false;
+    return;
 
   SetBeingUpgraded(extension, false);
 
@@ -2036,9 +2036,7 @@
         Extension::DISABLE_PERMISSIONS_INCREASE) {
       extensions::AddExtensionDisabledError(this, extension);
     }
-    // Although the extension is disabled, we technically did succeed in adding
-    // it to the list of installed extensions.
-    return true;
+    return;
   }
 
   // All apps that are displayed in the launcher are ordered by their ordinals
@@ -2049,8 +2047,6 @@
   extensions_.Insert(scoped_extension);
   SyncExtensionChangeIfNeeded(*extension);
   NotifyExtensionLoaded(extension);
-
-  return true;
 }
 
 void ExtensionService::InitializePermissions(const Extension* extension) {
@@ -2267,13 +2263,13 @@
     extension_prefs_->SetAllowFileAccess(id, true);
   }
 
+  content::NotificationService::current()->Notify(
+      chrome::NOTIFICATION_EXTENSION_INSTALLED,
+      content::Source<Profile>(profile_),
+      content::Details<const Extension>(extension));
+
   // Transfer ownership of |extension| to AddExtension.
-  if (AddExtension(scoped_extension)) {
-    content::NotificationService::current()->Notify(
-        chrome::NOTIFICATION_EXTENSION_INSTALLED,
-        content::Source<Profile>(profile_),
-        content::Details<const Extension>(extension));
-  }
+  AddExtension(scoped_extension);
 }
 
 const Extension* ExtensionService::GetExtensionByIdInternal(