Index: tools/json_schema_compiler/model.py |
diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py |
index 082fbc60f85910a71bcdb5c5d4ea94423bdeb8e7..37dcd01fc9dabf3045f9bba80d3298a65f78369a 100644 |
--- a/tools/json_schema_compiler/model.py |
+++ b/tools/json_schema_compiler/model.py |
@@ -34,6 +34,33 @@ class Model(object): |
self.namespaces[namespace.name] = namespace |
return namespace |
+class Feature(object): |
+ """ A Feature |
not at google - send to devlin
2013/09/12 16:20:43
"""A feature, as specified in files such as
chrome
dhnishi (use Chromium)
2013/09/13 17:36:42
Done.
|
+ |
+ Properties: |
+ - |name| the name of the feature |
+ - |constant_name| the name of the constant equivalent to the feature |
+ - |source_file| the file that contained the namespace definition |
+ - |source_file_dir| the directory component of |source_file| |
+ - |source_file_filename| the filename component of |source_file| |
+ - |channel| the channel where the feature is released |
+ - |extension_types| the types which can use the permission feature |
+ - |whitelist| a list of exetnsions allowed to use the feature |
+ """ |
+ def __init__(self, feature_name, feature_def, source_file): |
+ self.name = feature_name |
+ self.constant_name = self._constant_name(self.name) |
not at google - send to devlin
2013/09/12 16:20:43
this is a property of the C++ code not of the abst
dhnishi (use Chromium)
2013/09/13 17:36:42
Removed from the abstract model.
|
+ self.unix_name = UnixName(self.name) |
+ self.source_file = source_file |
+ self.source_file_dir, self.source_file_filename = os.path.split(source_file) |
not at google - send to devlin
2013/09/12 16:20:43
would be nice not to have source_file nor source_f
dhnishi (use Chromium)
2013/09/13 17:36:42
I don't think I had anything actually using those
|
+ self.channel = feature_def['channel'] |
+ self.extension_types = feature_def['extension_types'] |
+ self.whitelist = feature_def.get('whitelist') |
+ |
+ def _constant_name(self, target): |
not at google - send to devlin
2013/09/12 16:20:43
(move this into cpp_util.py if something like that
dhnishi (use Chromium)
2013/09/13 17:36:42
Done.
|
+ return ('k' + ''.join(word[0].upper() + word[1:] |
+ for word in target.replace('.', ' ').split())) |
+ |
class Namespace(object): |
"""An API namespace. |
@@ -491,3 +518,4 @@ def _GetPlatforms(json): |
platforms.append(platform_enum) |
break |
return platforms |
+ |
not at google - send to devlin
2013/09/12 16:20:43
no blank line?
dhnishi (use Chromium)
2013/09/13 17:36:42
Done.
|