Avoid crashes due to GetDefaultRequestContext returning NULL.

The change involves two things: check the return value of
Profile::GetDefaultRequestContext for NULL, and also shutting down the
ExtensionUpdater a little earlier than before (when the profile is
being destructed, instead of at ExtensionService destruction time).

BUG=70887
TEST=none


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73764 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 51b654a6..ef2b2a4b 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -484,9 +484,7 @@
 ExtensionService::~ExtensionService() {
   DCHECK(!profile_);  // Profile should have told us it's going away.
   UnloadAllExtensions();
-  if (updater_.get()) {
-    updater_->Stop();
-  }
+
   ProviderCollection::const_iterator i;
   for (i = external_extension_providers_.begin();
        i != external_extension_providers_.end(); ++i) {
@@ -1247,6 +1245,9 @@
 }
 
 void ExtensionService::DestroyingProfile() {
+  if (updater_.get()) {
+    updater_->Stop();
+  }
   browser_event_router_.reset();
   pref_change_registrar_.RemoveAll();
   profile_ = NULL;