Convert ExtensionRegistry to a BrowserContextKeyedService

This removes dependencies on ExtensionService, which does not exist for
app_shell.

* Convert all of src/extensions to use ExtensionRegistry's extension sets.
* Remove ExtensionService::blacklisted_extensions() and convert all callers
  to use ExtensionRegistry.

BUG=none
TEST=existing unit_tests, browser_tests
[email protected]
[email protected] for adding dependency on components/browser_context_keyed_service

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242624 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/extensions/browser/extension_registry.h b/extensions/browser/extension_registry.h
index c051fbb6..aedd11a 100644
--- a/extensions/browser/extension_registry.h
+++ b/extensions/browser/extension_registry.h
@@ -7,19 +7,28 @@
 
 #include <string>
 
+#include "base/compiler_specific.h"
 #include "base/memory/ref_counted.h"
+#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
 #include "extensions/common/extension_set.h"
 
+namespace content {
+class BrowserContext;
+}
+
 namespace extensions {
 class Extension;
 
 // ExtensionRegistry holds sets of the installed extensions for a given
-// BrowserContext.
-// TODO(jamescook): Convert this to a BrowserContextKeyedService.
-class ExtensionRegistry {
+// BrowserContext. An incognito browser context and its master browser context
+// share a single registry.
+class ExtensionRegistry : public BrowserContextKeyedService {
  public:
   ExtensionRegistry();
-  ~ExtensionRegistry();
+  virtual ~ExtensionRegistry();
+
+  // Returns the instance for the given |browser_context|.
+  static ExtensionRegistry* Get(content::BrowserContext* browser_context);
 
   // NOTE: These sets are *eventually* mututally exclusive, but an extension can
   // appear in two sets for short periods of time.
@@ -70,6 +79,9 @@
   void SetDisabledModificationCallback(
       const ExtensionSet::ModificationCallback& callback);
 
+  // BrowserContextKeyedService implementation:
+  virtual void Shutdown() OVERRIDE;
+
  private:
   // Extensions that are installed, enabled and not terminated.
   ExtensionSet enabled_extensions_;