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

Unified Diff: chrome/common/extensions/manifest_handler.cc

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome/common/extensions/manifest_handler.h ('k') | chrome/common/extensions/manifest_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/manifest_handler.cc
diff --git a/chrome/common/extensions/manifest_handler.cc b/chrome/common/extensions/manifest_handler.cc
index 389f4f5b4bf00607e0d8fed10f7f613c3ca32c68..96f138f8e40f6a278632c91da07a69c638c6d8f1 100644
--- a/chrome/common/extensions/manifest_handler.cc
+++ b/chrome/common/extensions/manifest_handler.cc
@@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/memory/linked_ptr.h"
#include "base/stl_util.h"
#include "chrome/common/extensions/manifest.h"
@@ -136,9 +137,6 @@ void ManifestHandlerRegistry::SortManifestHandlers() {
static base::LazyInstance<ManifestHandlerRegistry> g_registry =
LAZY_INSTANCE_INITIALIZER;
-static base::LazyInstance<std::vector<std::string> > g_empty_string_vector =
- LAZY_INSTANCE_INITIALIZER;
-
} // namespace
ManifestHandler::ManifestHandler() {
@@ -147,18 +145,24 @@ ManifestHandler::ManifestHandler() {
ManifestHandler::~ManifestHandler() {
}
-bool ManifestHandler::AlwaysParseForType(Manifest::Type type) {
+bool ManifestHandler::AlwaysParseForType(Manifest::Type type) const {
return false;
}
-const std::vector<std::string>& ManifestHandler::PrerequisiteKeys() {
- return g_empty_string_vector.Get();
+const std::vector<std::string> ManifestHandler::PrerequisiteKeys() const {
+ return std::vector<std::string>();
+}
+
+void ManifestHandler::Register() {
+ linked_ptr<ManifestHandler> this_linked(this);
+ const std::vector<std::string> keys = Keys();
+ for (size_t i = 0; i < keys.size(); ++i)
+ g_registry.Get().RegisterManifestHandler(keys[i], this_linked);
}
// static
-void ManifestHandler::Register(const std::string& key,
- linked_ptr<ManifestHandler> handler) {
- g_registry.Get().RegisterManifestHandler(key, handler);
+void ManifestHandler::ClearRegistryForTesting() {
+ g_registry.Get().ClearForTesting();
}
// static
@@ -167,8 +171,9 @@ bool ManifestHandler::ParseExtension(Extension* extension, string16* error) {
}
// static
-void ManifestHandler::ClearRegistryForTesting() {
- g_registry.Get().ClearForTesting();
+const std::vector<std::string> ManifestHandler::SingleKey(
+ const std::string& key) {
+ return std::vector<std::string>(1, key);
}
} // namespace extensions
« no previous file with comments | « chrome/common/extensions/manifest_handler.h ('k') | chrome/common/extensions/manifest_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698