Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ | |
| 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/string16.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class Value; | |
| 15 } | |
| 16 | |
| 17 namespace extensions { | |
| 18 | |
| 19 class Extension; | |
| 20 | |
| 21 class ManifestHandler { | |
| 22 // 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.
| |
| 23 // Returns true on success or false on failure; if false, |error| will | |
| 24 // be set to a failure message. | |
| 25 public: | |
| 26 ManifestHandler(); | |
| 27 virtual ~ManifestHandler(); | |
| 28 | |
| 29 virtual bool Parse(const base::Value* value, | |
| 30 Extension* extension, | |
| 31 string16* error) = 0; | |
| 32 }; | |
| 33 | |
| 34 // Associate |handler| with |key| in the manifest. Takes ownership of |handler|. | |
| 35 // TODO(yoz): Decide how to handle dotted subkeys. | |
| 36 // WARNING: Manifest handlers registered only in the browser process are not | |
| 37 // available to renderers. | |
| 38 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.
| |
| 39 | |
| 40 // Get the manifest handler associated with |key|, or NULL | |
| 41 // if there is none. | |
| 42 ManifestHandler* GetManifestHandler(const std::string& key); | |
| 43 | |
| 44 // If the handler is not handling most of the keys, it may be | |
| 45 // more efficient to have a list of keys to iterate over. | |
| 46 // TODO(yoz): this isn't the long-term solution. | |
| 47 std::vector<std::string> GetManifestHandlerKeys(); | |
| 48 | |
| 49 } // namespace extensions | |
| 50 | |
| 51 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ | |
| OLD | NEW |