Index: extensions/browser/extension_registry.cc |
diff --git a/extensions/browser/extension_registry.cc b/extensions/browser/extension_registry.cc |
index f4bd91e145bff6c4387b74ba7f35614de5a94651..a0325abf13a196c7cf5022d5fabd5f5a93831751 100644 |
--- a/extensions/browser/extension_registry.cc |
+++ b/extensions/browser/extension_registry.cc |
@@ -4,6 +4,7 @@ |
#include "extensions/browser/extension_registry.h" |
+#include "base/strings/string_util.h" |
#include "extensions/browser/extension_registry_factory.h" |
namespace extensions { |
@@ -16,6 +17,32 @@ ExtensionRegistry* ExtensionRegistry::Get(content::BrowserContext* context) { |
return ExtensionRegistryFactory::GetForBrowserContext(context); |
} |
+const Extension* ExtensionRegistry::GetExtensionById(const std::string& id, |
+ int include_mask) const { |
+ std::string lowercase_id = StringToLowerASCII(id); |
+ if (include_mask & INCLUDE_ENABLED) { |
+ const Extension* extension = enabled_extensions_.GetByID(lowercase_id); |
+ if (extension) |
+ return extension; |
+ } |
+ if (include_mask & INCLUDE_DISABLED) { |
+ const Extension* extension = disabled_extensions_.GetByID(lowercase_id); |
+ if (extension) |
+ return extension; |
+ } |
+ if (include_mask & INCLUDE_TERMINATED) { |
+ const Extension* extension = terminated_extensions_.GetByID(lowercase_id); |
+ if (extension) |
+ return extension; |
+ } |
+ if (include_mask & INCLUDE_BLACKLISTED) { |
+ const Extension* extension = blacklisted_extensions_.GetByID(lowercase_id); |
+ if (extension) |
+ return extension; |
+ } |
+ return NULL; |
+} |
+ |
bool ExtensionRegistry::AddEnabled( |
const scoped_refptr<const Extension>& extension) { |
return enabled_extensions_.Insert(extension); |