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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 dst_dict['link'] = self._GetLink(type_.ref_type) | 316 dst_dict['link'] = self._GetLink(type_.ref_type) |
317 elif type_.property_type == model.PropertyType.ARRAY: | 317 elif type_.property_type == model.PropertyType.ARRAY: |
318 dst_dict['array'] = self._GenerateType(type_.item_type) | 318 dst_dict['array'] = self._GenerateType(type_.item_type) |
319 elif type_.property_type == model.PropertyType.ENUM: | 319 elif type_.property_type == model.PropertyType.ENUM: |
320 dst_dict['enum_values'] = [ | 320 dst_dict['enum_values'] = [ |
321 {'name': value.name, 'description': value.description} | 321 {'name': value.name, 'description': value.description} |
322 for value in type_.enum_values] | 322 for value in type_.enum_values] |
323 if len(dst_dict['enum_values']) > 0: | 323 if len(dst_dict['enum_values']) > 0: |
324 dst_dict['enum_values'][-1]['last'] = True | 324 dst_dict['enum_values'][-1]['last'] = True |
325 elif type_.instance_of is not None: | 325 elif type_.instance_of is not None: |
326 dst_dict['simple_type'] = type_.instance_of.lower() | 326 dst_dict['simple_type'] = type_.instance_of |
327 else: | 327 else: |
328 dst_dict['simple_type'] = type_.property_type.name.lower() | 328 dst_dict['simple_type'] = type_.property_type.name |
329 | 329 |
330 def _GetIntroTableList(self): | 330 def _GetIntroTableList(self): |
331 '''Create a generic data structure that can be traversed by the templates | 331 '''Create a generic data structure that can be traversed by the templates |
332 to create an API intro table. | 332 to create an API intro table. |
333 ''' | 333 ''' |
334 intro_rows = [ | 334 intro_rows = [ |
335 self._GetIntroDescriptionRow(), | 335 self._GetIntroDescriptionRow(), |
336 self._GetIntroAvailabilityRow() | 336 self._GetIntroAvailabilityRow() |
337 ] + self._GetIntroDependencyRows() | 337 ] + self._GetIntroDependencyRows() |
338 | 338 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 # anything. Don't do it. | 560 # anything. Don't do it. |
561 if not IsPreviewServer(): | 561 if not IsPreviewServer(): |
562 handlebar_dict['samples'] = _LazySamplesGetter( | 562 handlebar_dict['samples'] = _LazySamplesGetter( |
563 handlebar_dict['name'], | 563 handlebar_dict['name'], |
564 self._samples) | 564 self._samples) |
565 return handlebar_dict | 565 return handlebar_dict |
566 | 566 |
567 def get(self, api_name, disable_refs=False): | 567 def get(self, api_name, disable_refs=False): |
568 return self._GenerateHandlebarContext( | 568 return self._GenerateHandlebarContext( |
569 self._get_schema_model(api_name, disable_refs)) | 569 self._get_schema_model(api_name, disable_refs)) |
OLD | NEW |