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

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

Issue 11446034: SupportsUserData and manifest handlers for Extension; use them for the Omnibox API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + manifestdata Created 8 years 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.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
new file mode 100644
index 0000000000000000000000000000000000000000..89e65093880121cca7f4e5cc15f078d2e7db9669
--- /dev/null
+++ b/chrome/common/extensions/manifest_handler.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
+#define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/string16.h"
+
+namespace base {
+class Value;
+}
+
+namespace extensions {
+
+class Extension;
+
+class ManifestHandler {
+ public:
+ ManifestHandler();
+ virtual ~ManifestHandler();
+
+ // Attempts to parse the manifest value.
+ // Returns true on success or false on failure; if false, |error| will
+ // be set to a failure message.
+ virtual bool Parse(const base::Value* value,
+ Extension* extension,
+ string16* error) = 0;
+
+ // Associate |handler| with |key| in the manifest. Takes ownership
+ // of |handler|. TODO(yoz): Decide how to handle dotted subkeys.
+ // WARNING: Manifest handlers registered only in the browser process
+ // are not available to renderers.
+ static void Register(const std::string& key, ManifestHandler* handler);
+
+ // Get the manifest handler associated with |key|, or NULL
+ // if there is none.
+ static ManifestHandler* Get(const std::string& key);
+
+ // If the handler is not handling most of the keys, it may be
+ // more efficient to have a list of keys to iterate over.
+ // TODO(yoz): this isn't the long-term solution.
+ static std::vector<std::string> GetKeys();
+};
+
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/manifest_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698