Delete the omahaproxy-backed extension blacklist and clear its entries from the
preferences file.

BUG=295882, 292673
[email protected], [email protected]

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224865 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 500e5b80..1e7ae32 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -414,7 +414,6 @@
                                                     extension_prefs,
                                                     profile->GetPrefs(),
                                                     profile,
-                                                    blacklist,
                                                     update_frequency));
   }
 
@@ -3095,32 +3094,29 @@
 void ExtensionService::OnBlacklistUpdated() {
   blacklist_->GetBlacklistedIDs(
       GenerateInstalledExtensionsSet()->GetIDs(),
-      base::Bind(&ExtensionService::ManageBlacklist,
-                 AsWeakPtr(),
-                 blacklisted_extensions_.GetIDs()));
+      base::Bind(&ExtensionService::ManageBlacklist, AsWeakPtr()));
 }
 
-void ExtensionService::ManageBlacklist(
-    const std::set<std::string>& old_blacklisted_ids,
-    const std::set<std::string>& new_blacklisted_ids) {
+void ExtensionService::ManageBlacklist(const std::set<std::string>& updated) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
+  std::set<std::string> before = blacklisted_extensions_.GetIDs();
   std::set<std::string> no_longer_blacklisted =
-      base::STLSetDifference<std::set<std::string> >(old_blacklisted_ids,
-                                                     new_blacklisted_ids);
+      base::STLSetDifference<std::set<std::string> >(before, updated);
   std::set<std::string> not_yet_blacklisted =
-      base::STLSetDifference<std::set<std::string> >(new_blacklisted_ids,
-                                                     old_blacklisted_ids);
+      base::STLSetDifference<std::set<std::string> >(updated, before);
 
   for (std::set<std::string>::iterator it = no_longer_blacklisted.begin();
        it != no_longer_blacklisted.end(); ++it) {
     scoped_refptr<const Extension> extension =
         blacklisted_extensions_.GetByID(*it);
-    DCHECK(extension.get()) << "Extension " << *it << " no longer blacklisted, "
-                            << "but it was never blacklisted.";
-    if (!extension.get())
+    if (!extension.get()) {
+      NOTREACHED() << "Extension " << *it << " no longer blacklisted, "
+                   << "but it was never blacklisted.";
       continue;
+    }
     blacklisted_extensions_.Remove(*it);
+    extension_prefs_->SetExtensionBlacklisted(extension->id(), false);
     AddExtension(extension.get());
     UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled",
                               extension->location(),
@@ -3130,11 +3126,13 @@
   for (std::set<std::string>::iterator it = not_yet_blacklisted.begin();
        it != not_yet_blacklisted.end(); ++it) {
     scoped_refptr<const Extension> extension = GetInstalledExtension(*it);
-    DCHECK(extension.get()) << "Extension " << *it << " needs to be "
-                            << "blacklisted, but it's not installed.";
-    if (!extension.get())
+    if (!extension.get()) {
+      NOTREACHED() << "Extension " << *it << " needs to be "
+                   << "blacklisted, but it's not installed.";
       continue;
+    }
     blacklisted_extensions_.Insert(extension);
+    extension_prefs_->SetExtensionBlacklisted(extension->id(), true);
     UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST);
     UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlacklistInstalled",
                               extension->location(), Manifest::NUM_LOCATIONS);