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