Changed EXTENSION_UNINSTALLED notification to happen after uninstallation.

The important part is that it comes after the EXTENSION_UNLOADED
notification is sent.  This makes it easier on the listeners, as they
can assume that extension notifications other than EXTENSION_UNINSTALLED
are sent for currently-installed extensions.

BUG=54415
TEST=BackgroundModeManagerTest

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=60834

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=60848

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61089 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 737f6894..03699fa8 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -768,16 +768,11 @@
   // Callers should not send us nonexistent extensions.
   DCHECK(extension);
 
-  // Notify interested parties that we're uninstalling this extension.
-  NotificationService::current()->Notify(
-      NotificationType::EXTENSION_UNINSTALLED,
-      Source<Profile>(profile_),
-      Details<Extension>(extension));
-
   // Get hold of information we need after unloading, since the extension
   // pointer will be invalid then.
   GURL extension_url(extension->url());
   Extension::Location location(extension->location());
+  UninstalledExtensionInfo uninstalled_extension_info(*extension);
 
   // Also copy the extension identifier since the reference might have been
   // obtained via Extension::id().
@@ -804,6 +799,12 @@
   }
 
   ClearExtensionData(extension_url);
+
+  // Notify interested parties that we've uninstalled this extension.
+  NotificationService::current()->Notify(
+      NotificationType::EXTENSION_UNINSTALLED,
+      Source<Profile>(profile_),
+      Details<UninstalledExtensionInfo>(&uninstalled_extension_info));
 }
 
 void ExtensionsService::ClearExtensionData(const GURL& extension_url) {