Chromium Code Reviews| Index: extensions/browser/extension_registry.h |
| diff --git a/extensions/browser/extension_registry.h b/extensions/browser/extension_registry.h |
| index d878e61e84db8ec44e56741cad14925dd997c038..b7c5c907112b4ceccc220e8fb27f6f08bb9840cc 100644 |
| --- a/extensions/browser/extension_registry.h |
| +++ b/extensions/browser/extension_registry.h |
| @@ -9,6 +9,7 @@ |
| #include "base/compiler_specific.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/observer_list.h" |
| #include "components/browser_context_keyed_service/browser_context_keyed_service.h" |
| #include "extensions/common/extension_set.h" |
| @@ -18,6 +19,7 @@ class BrowserContext; |
| namespace extensions { |
| class Extension; |
| +class ExtensionRegistryObserver; |
| // ExtensionRegistry holds sets of the installed extensions for a given |
| // BrowserContext. An incognito browser context and its master browser context |
| @@ -55,6 +57,10 @@ class ExtensionRegistry : public BrowserContextKeyedService { |
| return blacklisted_extensions_; |
| } |
| + // The usual observer interface. |
| + void AddObserver(ExtensionRegistryObserver* observer); |
| + void RemoveObserver(ExtensionRegistryObserver* observer); |
| + |
| // Find an extension by ID using |include_mask| to pick the sets to search: |
| // * enabled_extensions() --> ExtensionRegistry::ENABLED |
| // * disabled_extensions() --> ExtensionRegistry::DISABLED |
| @@ -64,6 +70,19 @@ class ExtensionRegistry : public BrowserContextKeyedService { |
| const Extension* GetExtensionById(const std::string& id, |
| int include_mask) const; |
| + // Removes an extension from the enabled and disabled sets. Invokes the |
| + // observer method OnExtensionUnloaded() after the extension is removed. |
| + void UnloadExtension(const scoped_refptr<const Extension>& extension); |
|
not at google - send to devlin
2014/01/21 23:58:59
I kind of preferred the way it was... making this
|
| + |
| + // Moves an extension to the enabled set from the disabled set. The extension |
| + // must exist in the disabled set. |
| + void EnableExtension(const scoped_refptr<const Extension>& extension); |
|
James Cook
2014/01/21 23:20:39
By adding this function and the one below I was ab
|
| + |
| + // Adds an extension to the disabled set and removes it from the enabled |
| + // and terminated sets. Invokes the observer method OnExtensionDisabled() |
| + // after the extension is added. |
| + void DisableExtension(const scoped_refptr<const Extension>& extension); |
| + |
| // Adds the specified extension to the enabled set. The registry becomes an |
| // owner. Any previous extension with the same ID is removed. |
| // Returns true if there is no previous extension. |
| @@ -71,15 +90,8 @@ class ExtensionRegistry : public BrowserContextKeyedService { |
| // method directly. |
| bool AddEnabled(const scoped_refptr<const Extension>& extension); |
| - // Removes the specified extension from the enabled set. |
| - // Returns true if the set contained the specified extension. |
| - // NOTE: You probably want to use ExtensionService instead of calling this |
| - // method directly. |
| - bool RemoveEnabled(const std::string& id); |
| - |
| // As above, but for the disabled set. |
| bool AddDisabled(const scoped_refptr<const Extension>& extension); |
| - bool RemoveDisabled(const std::string& id); |
| // As above, but for the terminated set. |
| bool AddTerminated(const scoped_refptr<const Extension>& extension); |
| @@ -117,6 +129,8 @@ class ExtensionRegistry : public BrowserContextKeyedService { |
| // un-blacklisted. |
| ExtensionSet blacklisted_extensions_; |
| + ObserverList<ExtensionRegistryObserver> observers_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); |
| }; |