| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 enum IncludeFlag { | 35 enum IncludeFlag { |
| 36 NONE = 0, | 36 NONE = 0, |
| 37 ENABLED = 1 << 0, | 37 ENABLED = 1 << 0, |
| 38 DISABLED = 1 << 1, | 38 DISABLED = 1 << 1, |
| 39 TERMINATED = 1 << 2, | 39 TERMINATED = 1 << 2, |
| 40 BLACKLISTED = 1 << 3, | 40 BLACKLISTED = 1 << 3, |
| 41 EVERYTHING = (1 << 4) - 1, | 41 EVERYTHING = (1 << 4) - 1, |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 explicit ExtensionRegistry(content::BrowserContext* browser_context); | 44 explicit ExtensionRegistry(content::BrowserContext* browser_context); |
| 45 virtual ~ExtensionRegistry(); | 45 ~ExtensionRegistry() override; |
| 46 | 46 |
| 47 // Returns the instance for the given |browser_context|. | 47 // Returns the instance for the given |browser_context|. |
| 48 static ExtensionRegistry* Get(content::BrowserContext* browser_context); | 48 static ExtensionRegistry* Get(content::BrowserContext* browser_context); |
| 49 | 49 |
| 50 content::BrowserContext* browser_context() const { return browser_context_; } | 50 content::BrowserContext* browser_context() const { return browser_context_; } |
| 51 | 51 |
| 52 // NOTE: These sets are *eventually* mutually exclusive, but an extension can | 52 // NOTE: These sets are *eventually* mutually exclusive, but an extension can |
| 53 // appear in two sets for short periods of time. | 53 // appear in two sets for short periods of time. |
| 54 const ExtensionSet& enabled_extensions() const { | 54 const ExtensionSet& enabled_extensions() const { |
| 55 return enabled_extensions_; | 55 return enabled_extensions_; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // Removes all extensions from all sets. | 139 // Removes all extensions from all sets. |
| 140 void ClearAll(); | 140 void ClearAll(); |
| 141 | 141 |
| 142 // Sets a callback to run when the disabled extension set is modified. | 142 // Sets a callback to run when the disabled extension set is modified. |
| 143 // TODO(jamescook): This is too specific for a generic registry; find some | 143 // TODO(jamescook): This is too specific for a generic registry; find some |
| 144 // other way to do this. | 144 // other way to do this. |
| 145 void SetDisabledModificationCallback( | 145 void SetDisabledModificationCallback( |
| 146 const ExtensionSet::ModificationCallback& callback); | 146 const ExtensionSet::ModificationCallback& callback); |
| 147 | 147 |
| 148 // KeyedService implementation: | 148 // KeyedService implementation: |
| 149 virtual void Shutdown() override; | 149 void Shutdown() override; |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 // Extensions that are installed, enabled and not terminated. | 152 // Extensions that are installed, enabled and not terminated. |
| 153 ExtensionSet enabled_extensions_; | 153 ExtensionSet enabled_extensions_; |
| 154 | 154 |
| 155 // Extensions that are installed and disabled. | 155 // Extensions that are installed and disabled. |
| 156 ExtensionSet disabled_extensions_; | 156 ExtensionSet disabled_extensions_; |
| 157 | 157 |
| 158 // Extensions that are installed and terminated. | 158 // Extensions that are installed and terminated. |
| 159 ExtensionSet terminated_extensions_; | 159 ExtensionSet terminated_extensions_; |
| 160 | 160 |
| 161 // Extensions that are installed and blacklisted. Generally these shouldn't be | 161 // Extensions that are installed and blacklisted. Generally these shouldn't be |
| 162 // considered as installed by the extension platform: we only keep them around | 162 // considered as installed by the extension platform: we only keep them around |
| 163 // so that if extensions are blacklisted by mistake they can easily be | 163 // so that if extensions are blacklisted by mistake they can easily be |
| 164 // un-blacklisted. | 164 // un-blacklisted. |
| 165 ExtensionSet blacklisted_extensions_; | 165 ExtensionSet blacklisted_extensions_; |
| 166 | 166 |
| 167 ObserverList<ExtensionRegistryObserver> observers_; | 167 ObserverList<ExtensionRegistryObserver> observers_; |
| 168 | 168 |
| 169 content::BrowserContext* const browser_context_; | 169 content::BrowserContext* const browser_context_; |
| 170 | 170 |
| 171 DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); | 171 DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 } // namespace extensions | 174 } // namespace extensions |
| 175 | 175 |
| 176 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ | 176 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ |
| OLD | NEW |