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 import copy | 5 import copy |
6 import os.path | 6 import os.path |
7 import re | 7 import re |
8 | 8 |
9 class ParseException(Exception): | 9 class ParseException(Exception): |
10 """Thrown when data in the model is invalid. | 10 """Thrown when data in the model is invalid. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 - |description| a description of the function (if provided) | 133 - |description| a description of the function (if provided) |
134 - |callback| the callback parameter to the function. There should be exactly | 134 - |callback| the callback parameter to the function. There should be exactly |
135 one | 135 one |
136 """ | 136 """ |
137 def __init__(self, parent, json): | 137 def __init__(self, parent, json): |
138 self.name = json['name'] | 138 self.name = json['name'] |
139 self.params = [] | 139 self.params = [] |
140 self.description = json.get('description') | 140 self.description = json.get('description') |
141 self.callback = None | 141 self.callback = None |
142 self.parent = parent | 142 self.parent = parent |
| 143 self.nocompile = json.get('nocompile') |
143 for param in json['parameters']: | 144 for param in json['parameters']: |
144 if param.get('type') == 'function': | 145 if param.get('type') == 'function': |
145 if self.callback: | 146 if self.callback: |
146 raise ParseException(self, self.name + " has more than one callback") | 147 raise ParseException(self, self.name + " has more than one callback") |
147 self.callback = Callback(self, param) | 148 self.callback = Callback(self, param) |
148 else: | 149 else: |
149 self.params.append(Property(self, param['name'], param, | 150 self.params.append(Property(self, param['name'], param, |
150 from_json=True)) | 151 from_json=True)) |
151 | 152 |
152 class Property(object): | 153 class Property(object): |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 # handled in pure Javascript on the render process (and .: never reach | 361 # handled in pure Javascript on the render process (and .: never reach |
361 # C++ let alone the browser). | 362 # C++ let alone the browser). |
362 if property_json.get('type') == 'function': | 363 if property_json.get('type') == 'function': |
363 continue | 364 continue |
364 model.properties[name] = Property( | 365 model.properties[name] = Property( |
365 model, | 366 model, |
366 name, | 367 name, |
367 property_json, | 368 property_json, |
368 from_json=from_json, | 369 from_json=from_json, |
369 from_client=from_client) | 370 from_client=from_client) |
OLD | NEW |