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

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

Issue 12091115: Allow manifest handlers to declare keys they depend on that must be parsed before them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dcronin 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/extension_unittest.cc ('k') | chrome/common/extensions/manifest_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/manifest_handler.h
diff --git a/chrome/common/extensions/manifest_handler.h b/chrome/common/extensions/manifest_handler.h
index 22c1a17f7470cd51fd8fceb5c5e99282fe4b436e..63380c7c4fed07bdf92c8039d491ecfb6789e422 100644
--- a/chrome/common/extensions/manifest_handler.h
+++ b/chrome/common/extensions/manifest_handler.h
@@ -8,6 +8,7 @@
#include <set>
#include <string>
+#include "base/memory/linked_ptr.h"
#include "base/string16.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/manifest.h"
@@ -32,17 +33,27 @@ class ManifestHandler {
// TODO(yoz): Use Feature availability instead.
virtual bool AlwaysParseForType(Manifest::Type type);
+ // The list of keys that, if present, should be parsed before calling our
+ // Parse (typically, because our Parse needs to read those keys).
+ // Defaults to empty.
+ virtual const std::vector<std::string>& PrerequisiteKeys();
+
// Associate |handler| with |key| in the manifest. A handler can register
// for multiple keys. The global registry takes ownership of |handler|;
// if it has an existing handler for |key|, it replaces it with this one.
//
// WARNING: Manifest handlers registered only in the browser process
// are not available to renderers or utility processes.
- static void Register(const std::string& key, ManifestHandler* handler);
+ static void Register(const std::string& key,
+ linked_ptr<ManifestHandler> handler);
// Call Parse on all registered manifest handlers that should parse
// this extension.
static bool ParseExtension(Extension* extension, string16* error);
+
+ // Reset the manifest handler registry to an empty state. Useful for
+ // unit tests.
+ static void ClearRegistryForTesting();
};
} // namespace extensions
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | chrome/common/extensions/manifest_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698