| Index: chrome/common/extensions/manifest_handler.h
|
| diff --git a/chrome/common/extensions/manifest_handler.h b/chrome/common/extensions/manifest_handler.h
|
| index f9797d3bd7db5ef061ad35fa1431eed2da2ce031..ecd5c9d3419ecdb260773cd383e7011f513ed871 100644
|
| --- a/chrome/common/extensions/manifest_handler.h
|
| +++ b/chrome/common/extensions/manifest_handler.h
|
| @@ -5,54 +5,47 @@
|
| #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
|
| #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
|
|
|
| +#include <set>
|
| #include <string>
|
| -#include <vector>
|
|
|
| #include "base/string16.h"
|
| -
|
| -namespace base {
|
| -class Value;
|
| -}
|
| +#include "chrome/common/extensions/extension.h"
|
|
|
| namespace extensions {
|
|
|
| -class Extension;
|
| +class Manifest;
|
|
|
| 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;
|
| -
|
| - // Perform any initialization which is necessary when the Handler's key is
|
| - // not present in the manifest.
|
| + // Attempts to parse the extension's manifest.
|
| // Returns true on success or false on failure; if false, |error| will
|
| // be set to a failure message.
|
| - virtual bool HasNoKey(Extension* extension, string16* error);
|
| -
|
| - // Associate |handler| with |key| in the manifest. Takes ownership
|
| - // of |handler|. TODO(yoz): Decide how to handle dotted subkeys.
|
| + virtual bool Parse(Extension* extension, string16* error) = 0;
|
| +
|
| + // If false (the default), only parse the manifest if a registered
|
| + // key is present in the manifest. If true, always attempt to parse
|
| + // the manifest for this extension type, even if no registered keys
|
| + // are present. This allows specifying a default parsed value for
|
| + // extensions that don't declare our key in the manifest.
|
| + // TODO(yoz): Use Feature availability instead.
|
| + virtual bool AlwaysParseForType(Extension::Type type);
|
| +
|
| + // 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.
|
| + // are not available to renderers or utility processes.
|
| 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();
|
| + // Call Parse on all registered manifest handlers that should parse
|
| + // this extension.
|
| + static bool ParseExtension(Extension* extension, string16* error);
|
| };
|
|
|
| -
|
| } // namespace extensions
|
|
|
| #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_
|
|
|