Show alert failure for reloading unpacked extensions with bad manifest
files when refreshing extensions page.

Screenshot:
http://i.imgur.com/02tzoUK.png

BUG=375276

Review URL: https://codereview.chromium.org/342003005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283852 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 77d1ca96..dbadeb6 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -599,10 +599,11 @@
 #endif
 }
 
-void ExtensionService::ReloadExtension(
+void ExtensionService::ReloadExtensionImpl(
     // "transient" because the process of reloading may cause the reference
     // to become invalid. Instead, use |extension_id|, a copy.
-    const std::string& transient_extension_id) {
+    const std::string& transient_extension_id,
+    bool be_noisy) {
 #if defined(ENABLE_EXTENSIONS)
   CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
@@ -686,13 +687,25 @@
     // We should always be able to remember the extension's path. If it's not in
     // the map, someone failed to update |unloaded_extension_paths_|.
     CHECK(!path.empty());
-    extensions::UnpackedInstaller::Create(this)->Load(path);
+    scoped_refptr<extensions::UnpackedInstaller> unpacked_installer =
+        extensions::UnpackedInstaller::Create(this);
+    unpacked_installer->set_be_noisy_on_failure(be_noisy);
+    unpacked_installer->Load(path);
   }
   // When reloading is done, mark this extension as done reloading.
   SetBeingReloaded(extension_id, false);
 #endif  // defined(ENABLE_EXTENSIONS)
 }
 
+void ExtensionService::ReloadExtension(const std::string& extension_id) {
+  ReloadExtensionImpl(extension_id, true); // be_noisy
+}
+
+void ExtensionService::ReloadExtensionWithQuietFailure(
+    const std::string& extension_id) {
+  ReloadExtensionImpl(extension_id, false); // be_noisy
+}
+
 bool ExtensionService::UninstallExtension(
     // "transient" because the process of uninstalling may cause the reference
     // to become invalid. Instead, use |extenson->id()|.