| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Returns true on success or false on failure; if false, |error| will | 27 // Returns true on success or false on failure; if false, |error| will |
| 28 // be set to a failure message. | 28 // be set to a failure message. |
| 29 virtual bool Parse(const base::Value* value, | 29 virtual bool Parse(const base::Value* value, |
| 30 Extension* extension, | 30 Extension* extension, |
| 31 string16* error) = 0; | 31 string16* error) = 0; |
| 32 | 32 |
| 33 // Perform any initialization which is necessary when the Handler's key is | 33 // Perform any initialization which is necessary when the Handler's key is |
| 34 // not present in the manifest. | 34 // not present in the manifest. |
| 35 // Returns true on success or false on failure; if false, |error| will | 35 // Returns true on success or false on failure; if false, |error| will |
| 36 // be set to a failure message. | 36 // be set to a failure message. |
| 37 virtual bool HasNoKey(Extension* extension, string16* error) { | 37 virtual bool HasNoKey(Extension* extension, string16* error); |
| 38 return true; | |
| 39 } | |
| 40 | 38 |
| 41 // Associate |handler| with |key| in the manifest. Takes ownership | 39 // Associate |handler| with |key| in the manifest. Takes ownership |
| 42 // of |handler|. TODO(yoz): Decide how to handle dotted subkeys. | 40 // of |handler|. TODO(yoz): Decide how to handle dotted subkeys. |
| 43 // WARNING: Manifest handlers registered only in the browser process | 41 // WARNING: Manifest handlers registered only in the browser process |
| 44 // are not available to renderers. | 42 // are not available to renderers. |
| 45 static void Register(const std::string& key, ManifestHandler* handler); | 43 static void Register(const std::string& key, ManifestHandler* handler); |
| 46 | 44 |
| 47 // Get the manifest handler associated with |key|, or NULL | 45 // Get the manifest handler associated with |key|, or NULL |
| 48 // if there is none. | 46 // if there is none. |
| 49 static ManifestHandler* Get(const std::string& key); | 47 static ManifestHandler* Get(const std::string& key); |
| 50 | 48 |
| 51 // If the handler is not handling most of the keys, it may be | 49 // If the handler is not handling most of the keys, it may be |
| 52 // more efficient to have a list of keys to iterate over. | 50 // more efficient to have a list of keys to iterate over. |
| 53 // TODO(yoz): this isn't the long-term solution. | 51 // TODO(yoz): this isn't the long-term solution. |
| 54 static std::vector<std::string> GetKeys(); | 52 static std::vector<std::string> GetKeys(); |
| 55 }; | 53 }; |
| 56 | 54 |
| 57 | 55 |
| 58 } // namespace extensions | 56 } // namespace extensions |
| 59 | 57 |
| 60 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ | 58 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLER_H_ |
| OLD | NEW |