summaryrefslogtreecommitdiffstats
path: root/extensions/browser/extension_registry.h
diff options
context:
space:
mode:
authormlerman <mlerman@chromium.org>2014-11-26 14:10:53 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-26 22:11:48 +0000
commit6a37b6a4b4914a5e762f90b673d1711ab8df7770 (patch)
treeb81f471d9736fdc43646f5df42f33ebeffee5929 /extensions/browser/extension_registry.h
parent3a333b59a1e6a4fee8f241adce935b12319662ea (diff)
downloadchromium_src-6a37b6a4b4914a5e762f90b673d1711ab8df7770.zip
chromium_src-6a37b6a4b4914a5e762f90b673d1711ab8df7770.tar.gz
chromium_src-6a37b6a4b4914a5e762f90b673d1711ab8df7770.tar.bz2
Temporarily disable extensions and sync while a profile is locked.
Place all the heavy lifting and logic in profiles code, with extensions providing a new collection for holding "locked" extensions. This replaces CL 697143003. BUG=354124 Review URL: https://codereview.chromium.org/695133005 Cr-Commit-Position: refs/heads/master@{#305897}
Diffstat (limited to 'extensions/browser/extension_registry.h')
-rw-r--r--extensions/browser/extension_registry.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/extensions/browser/extension_registry.h b/extensions/browser/extension_registry.h
index 50f75c9..d29a37b 100644
--- a/extensions/browser/extension_registry.h
+++ b/extensions/browser/extension_registry.h
@@ -33,12 +33,13 @@ class ExtensionRegistry : public KeyedService {
public:
// Flags to pass to GetExtensionById() to select which sets to look in.
enum IncludeFlag {
- NONE = 0,
- ENABLED = 1 << 0,
- DISABLED = 1 << 1,
- TERMINATED = 1 << 2,
+ NONE = 0,
+ ENABLED = 1 << 0,
+ DISABLED = 1 << 1,
+ TERMINATED = 1 << 2,
BLACKLISTED = 1 << 3,
- EVERYTHING = (1 << 4) - 1,
+ BLOCKED = 1 << 4,
+ EVERYTHING = (1 << 5) - 1,
};
explicit ExtensionRegistry(content::BrowserContext* browser_context);
@@ -63,11 +64,21 @@ class ExtensionRegistry : public KeyedService {
const ExtensionSet& blacklisted_extensions() const {
return blacklisted_extensions_;
}
+ const ExtensionSet& blocked_extensions() const { return blocked_extensions_; }
- // Returns a set of all installed, disabled, blacklisted, and terminated
- // extensions.
+ // Returns the set of all installed extensions, regardless of state (enabled,
+ // disabled, etc). Equivalent to GenerateInstalledExtensionSet(EVERYTHING).
scoped_ptr<ExtensionSet> GenerateInstalledExtensionsSet() const;
+ // Returns a set of all extensions in the subsets specified by |include_mask|.
+ // * enabled_extensions() --> ExtensionRegistry::ENABLED
+ // * disabled_extensions() --> ExtensionRegistry::DISABLED
+ // * terminated_extensions() --> ExtensionRegistry::TERMINATED
+ // * blacklisted_extensions() --> ExtensionRegistry::BLACKLISTED
+ // * blocked_extensions() --> ExtensionRegistry::BLOCKED
+ scoped_ptr<ExtensionSet> GenerateInstalledExtensionsSet(
+ int include_mask) const;
+
// The usual observer interface.
void AddObserver(ExtensionRegistryObserver* observer);
void RemoveObserver(ExtensionRegistryObserver* observer);
@@ -107,6 +118,7 @@ class ExtensionRegistry : public KeyedService {
// * disabled_extensions() --> ExtensionRegistry::DISABLED
// * terminated_extensions() --> ExtensionRegistry::TERMINATED
// * blacklisted_extensions() --> ExtensionRegistry::BLACKLISTED
+ // * blocked_extensions() --> ExtensionRegistry::BLOCKED
// Returns NULL if the extension is not found in the selected sets.
const Extension* GetExtensionById(const std::string& id,
int include_mask) const;
@@ -136,6 +148,10 @@ class ExtensionRegistry : public KeyedService {
bool AddBlacklisted(const scoped_refptr<const Extension>& extension);
bool RemoveBlacklisted(const std::string& id);
+ // As above, but for the blocked set.
+ bool AddBlocked(const scoped_refptr<const Extension>& extension);
+ bool RemoveBlocked(const std::string& id);
+
// Removes all extensions from all sets.
void ClearAll();
@@ -164,6 +180,9 @@ class ExtensionRegistry : public KeyedService {
// un-blacklisted.
ExtensionSet blacklisted_extensions_;
+ // Extensions that are installed and blocked. Will never be loaded.
+ ExtensionSet blocked_extensions_;
+
ObserverList<ExtensionRegistryObserver> observers_;
content::BrowserContext* const browser_context_;