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 logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 from environment import IsPreviewServer | 9 from environment import IsPreviewServer |
10 from extensions_paths import ( | 10 from extensions_paths import ( |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 else: | 291 else: |
292 self._RenderTypeInformation(type_, property_dict) | 292 self._RenderTypeInformation(type_, property_dict) |
293 | 293 |
294 return property_dict | 294 return property_dict |
295 | 295 |
296 def _GenerateCallbackProperty(self, callback): | 296 def _GenerateCallbackProperty(self, callback): |
297 property_dict = { | 297 property_dict = { |
298 'name': callback.simple_name, | 298 'name': callback.simple_name, |
299 'description': self._FormatDescription(callback.description), | 299 'description': self._FormatDescription(callback.description), |
300 'optional': callback.optional, | 300 'optional': callback.optional, |
| 301 'is_callback': True, |
301 'id': _CreateId(callback, 'property'), | 302 'id': _CreateId(callback, 'property'), |
302 'simple_type': 'function', | 303 'simple_type': 'function', |
303 } | 304 } |
304 if (callback.parent is not None and | 305 if (callback.parent is not None and |
305 not isinstance(callback.parent, model.Namespace)): | 306 not isinstance(callback.parent, model.Namespace)): |
306 property_dict['parentName'] = callback.parent.simple_name | 307 property_dict['parentName'] = callback.parent.simple_name |
307 return property_dict | 308 return property_dict |
308 | 309 |
309 def _RenderTypeInformation(self, type_, dst_dict): | 310 def _RenderTypeInformation(self, type_, dst_dict): |
310 dst_dict['is_object'] = type_.property_type == model.PropertyType.OBJECT | 311 dst_dict['is_object'] = type_.property_type == model.PropertyType.OBJECT |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 # anything. Don't do it. | 563 # anything. Don't do it. |
563 if not IsPreviewServer(): | 564 if not IsPreviewServer(): |
564 handlebar_dict['samples'] = _LazySamplesGetter( | 565 handlebar_dict['samples'] = _LazySamplesGetter( |
565 handlebar_dict['name'], | 566 handlebar_dict['name'], |
566 self._samples) | 567 self._samples) |
567 return handlebar_dict | 568 return handlebar_dict |
568 | 569 |
569 def get(self, api_name, disable_refs=False): | 570 def get(self, api_name, disable_refs=False): |
570 return self._GenerateHandlebarContext( | 571 return self._GenerateHandlebarContext( |
571 self._get_schema_model(api_name, disable_refs)) | 572 self._get_schema_model(api_name, disable_refs)) |
OLD | NEW |