| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 def _GetLink(self, link): | 95 def _GetLink(self, link): |
| 96 if self._disable_refs: | 96 if self._disable_refs: |
| 97 type_name = link.split('.', 1)[-1] | 97 type_name = link.split('.', 1)[-1] |
| 98 return { 'href': '#type-%s' % type_name, 'text': link, 'name': link } | 98 return { 'href': '#type-%s' % type_name, 'text': link, 'name': link } |
| 99 return self._ref_resolver.SafeGetLink(link, namespace=self._namespace.name) | 99 return self._ref_resolver.SafeGetLink(link, namespace=self._namespace.name) |
| 100 | 100 |
| 101 def ToDict(self): | 101 def ToDict(self): |
| 102 if self._namespace is None: | 102 if self._namespace is None: |
| 103 return {} | 103 return {} |
| 104 chrome_dot_name = 'chrome.%s' % self._namespace.name |
| 104 as_dict = { | 105 as_dict = { |
| 105 'name': self._namespace.name, | 106 'name': self._namespace.name, |
| 107 'namespace': self._namespace.documentation_options.get('namespace', |
| 108 chrome_dot_name), |
| 109 'title': self._namespace.documentation_options.get('title', |
| 110 chrome_dot_name), |
| 106 'documentationOptions': self._namespace.documentation_options, | 111 'documentationOptions': self._namespace.documentation_options, |
| 107 'types': self._GenerateTypes(self._namespace.types.values()), | 112 'types': self._GenerateTypes(self._namespace.types.values()), |
| 108 'functions': self._GenerateFunctions(self._namespace.functions), | 113 'functions': self._GenerateFunctions(self._namespace.functions), |
| 109 'events': self._GenerateEvents(self._namespace.events), | 114 'events': self._GenerateEvents(self._namespace.events), |
| 110 'domEvents': self._GenerateDomEvents(self._namespace.events), | 115 'domEvents': self._GenerateDomEvents(self._namespace.events), |
| 111 'properties': self._GenerateProperties(self._namespace.properties), | 116 'properties': self._GenerateProperties(self._namespace.properties), |
| 112 } | 117 } |
| 113 # Rendering the intro list is really expensive and there's no point doing it | 118 # Rendering the intro list is really expensive and there's no point doing it |
| 114 # unless we're rending the page - and disable_refs=True implies we're not. | 119 # unless we're rending the page - and disable_refs=True implies we're not. |
| 115 if not self._disable_refs: | 120 if not self._disable_refs: |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 # anything. Don't do it. | 560 # anything. Don't do it. |
| 556 if not IsPreviewServer(): | 561 if not IsPreviewServer(): |
| 557 handlebar_dict['samples'] = _LazySamplesGetter( | 562 handlebar_dict['samples'] = _LazySamplesGetter( |
| 558 handlebar_dict['name'], | 563 handlebar_dict['name'], |
| 559 self._samples) | 564 self._samples) |
| 560 return handlebar_dict | 565 return handlebar_dict |
| 561 | 566 |
| 562 def get(self, api_name, disable_refs=False): | 567 def get(self, api_name, disable_refs=False): |
| 563 return self._GenerateHandlebarContext( | 568 return self._GenerateHandlebarContext( |
| 564 self._get_schema_model(api_name, disable_refs)) | 569 self._get_schema_model(api_name, disable_refs)) |
| OLD | NEW |