diff options
author | ahernandez.miralles@gmail.com <ahernandez.miralles@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-01 22:02:10 +0000 |
---|---|---|
committer | ahernandez.miralles@gmail.com <ahernandez.miralles@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-01 22:02:10 +0000 |
commit | 9199e4929c802dc6f114982b3af980cfa8ac1ce3 (patch) | |
tree | 71abb149784dc3ee5984f8df7cd43c88996a69f3 /chrome/common/extensions/docs/server2/jsc_view.py | |
parent | 1ebdfd3cd7b3a7c91b21df447e2f9a9b33eb5864 (diff) | |
download | chromium_src-9199e4929c802dc6f114982b3af980cfa8ac1ce3.zip chromium_src-9199e4929c802dc6f114982b3af980cfa8ac1ce3.tar.gz chromium_src-9199e4929c802dc6f114982b3af980cfa8ac1ce3.tar.bz2 |
Docserver: Add annotation to intro_tables.json to restrict content by platform
BUG=233971
NOTRY=True
Review URL: https://codereview.chromium.org/438963003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287101 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/server2/jsc_view.py')
-rw-r--r-- | chrome/common/extensions/docs/server2/jsc_view.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/chrome/common/extensions/docs/server2/jsc_view.py b/chrome/common/extensions/docs/server2/jsc_view.py index 73859c1..70718d3 100644 --- a/chrome/common/extensions/docs/server2/jsc_view.py +++ b/chrome/common/extensions/docs/server2/jsc_view.py @@ -11,6 +11,7 @@ from api_schema_graph import APINodeCursor from docs_server_utils import MarkFirstAndLast from extensions_paths import JSON_TEMPLATES, PRIVATE_TEMPLATES from operator import itemgetter +from platform_util import PlatformToExtensionType import third_party.json_schema_compiler.model as model @@ -59,8 +60,6 @@ def _FormatValue(value): return ','.join([s[max(0, i - 3):i] for i in range(len(s), 0, -3)][::-1]) - - class JSCView(object): '''Uses a Model from the JSON Schema Compiler and generates a dict that a Handlebar template can use for a data source. @@ -73,7 +72,8 @@ class JSCView(object): json_cache, template_cache, features_bundle, - event_byname_future): + event_byname_future, + platform): self._content_script_apis = content_script_apis self._availability = availability_finder.GetAPIAvailability(jsc_model.name) self._current_node = APINodeCursor(availability_finder, jsc_model.name) @@ -85,6 +85,7 @@ class JSCView(object): self._template_cache = template_cache self._event_byname_future = event_byname_future self._jsc_model = jsc_model + self._platform = platform def _GetLink(self, link): ref = link if '.' in link else (self._jsc_model.name + '.' + link) @@ -544,6 +545,10 @@ class JSCView(object): for category in table_info.iterkeys(): content = [] for node in table_info[category]: + ext_type = PlatformToExtensionType(self._platform) + # Don't display nodes restricted to a different platform. + if ext_type not in node.get('extension_types', (ext_type,)): + continue # If there is a 'partial' argument and it hasn't already been # converted to a Handlebar object, transform it to a template. if 'partial' in node: |