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

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: 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
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..2a39fbc5db35af236c4be4a706eacfb9e2ea3f15
--- /dev/null
+++ b/chrome/common/extensions/manifest_handler.h
@@ -0,0 +1,51 @@
+// 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 {
+ // Attempts to parse the manifest value.
Matt Perry 2012/12/07 01:22:59 This comment seems to have wandered away from home
Yoyo Zhou 2012/12/07 02:13:32 Found its way back.
+ // Returns true on success or false on failure; if false, |error| will
+ // be set to a failure message.
+ public:
+ ManifestHandler();
+ virtual ~ManifestHandler();
+
+ 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.
+void RegisterManifestHandler(const std::string& key, ManifestHandler* handler);
Matt Perry 2012/12/07 01:22:59 Make these static methods of ManifestHandler?
Yoyo Zhou 2012/12/07 02:13:32 Sure.
+
+// Get the manifest handler associated with |key|, or NULL
+// if there is none.
+ManifestHandler* GetManifestHandler(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.
+std::vector<std::string> GetManifestHandlerKeys();
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698