Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: extensions/browser/extension_registry.cc

Issue 125573002: Move ExtensionService::GetExtensionById() to ExtensionRegistry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698