diff options
6 files changed, 28 insertions, 14 deletions
diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py index c3d90d4..c57ecc5 100644 --- a/chrome/common/extensions/docs/server2/api_data_source.py +++ b/chrome/common/extensions/docs/server2/api_data_source.py @@ -71,7 +71,8 @@ class APIDataSource(DataSource): self._json_cache, self._template_cache, self._platform_bundle.GetFeaturesBundle(platform), - self._LoadEventByName(platform)).ToDict() + self._LoadEventByName(platform), + platform).ToDict() self._view_cache.Set(object_store_key, jsc_view) return jsc_view return Future(callback=resolve) diff --git a/chrome/common/extensions/docs/server2/app.yaml b/chrome/common/extensions/docs/server2/app.yaml index 50b14ed..be98349 100644 --- a/chrome/common/extensions/docs/server2/app.yaml +++ b/chrome/common/extensions/docs/server2/app.yaml @@ -1,5 +1,5 @@ application: chrome-apps-doc -version: 3-38-0 +version: 3-39-0 runtime: python27 api_version: 1 threadsafe: false diff --git a/chrome/common/extensions/docs/server2/cron.yaml b/chrome/common/extensions/docs/server2/cron.yaml index 888235d..a924077 100644 --- a/chrome/common/extensions/docs/server2/cron.yaml +++ b/chrome/common/extensions/docs/server2/cron.yaml @@ -2,4 +2,4 @@ cron: - description: Repopulates all cached data. url: /_cron schedule: every 5 minutes - target: 3-38-0 + target: 3-39-0 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: diff --git a/chrome/common/extensions/docs/server2/jsc_view_test.py b/chrome/common/extensions/docs/server2/jsc_view_test.py index 1490e94..57d9823 100755 --- a/chrome/common/extensions/docs/server2/jsc_view_test.py +++ b/chrome/common/extensions/docs/server2/jsc_view_test.py @@ -123,7 +123,8 @@ class JSCViewTest(unittest.TestCase): self._json_cache, _FakeTemplateCache(), self._features_bundle, - None).ToDict() + None, + 'extensions').ToDict() self.assertEquals('type-TypeA', dict_['types'][0]['id']) self.assertEquals('property-TypeA-b', dict_['types'][0]['properties'][0]['id']) @@ -140,7 +141,8 @@ class JSCViewTest(unittest.TestCase): self._json_cache, _FakeTemplateCache(), self._features_bundle, - None).ToDict() + None, + 'extensions').ToDict() self.assertEquals(expected_json, dict_) def testAddRules(self): @@ -151,7 +153,8 @@ class JSCViewTest(unittest.TestCase): self._json_cache, _FakeTemplateCache(), self._features_bundle, - self._FakeLoadAddRulesSchema()).ToDict() + self._FakeLoadAddRulesSchema(), + 'extensions').ToDict() # Check that the first event has the addRulesFunction defined. self.assertEquals('add_rules_tester', dict_['name']) @@ -176,7 +179,8 @@ class JSCViewTest(unittest.TestCase): self._json_cache, _FakeTemplateCache(), self._features_bundle, - None) + None, + 'extensions') expected_list = [ { 'title': 'Description', 'content': [ @@ -238,7 +242,8 @@ class JSCViewTest(unittest.TestCase): self._json_cache, _FakeTemplateCache(), self._features_bundle, - None) + None, + 'extensions') expected_list[1] = { 'title': 'Availability', 'content': [ @@ -282,7 +287,8 @@ class JSCViewWithoutNodeAvailabilityTest(unittest.TestCase): self._json_cache, _FakeTemplateCache(), _FakeFeaturesBundle(), - None).ToDict() + None, + 'extensions').ToDict() self.assertEquals(availability, model_dict['introList'][1]['content'][0]['version']) @@ -356,7 +362,8 @@ class JSCViewWithNodeAvailabilityTest(unittest.TestCase): self._json_cache, _FakeTemplateCache(), _FakeFeaturesBundle(), - None).ToDict() + None, + 'extensions').ToDict() # Test nodes that have the same availability as their parent. diff --git a/chrome/common/extensions/docs/templates/json/intro_tables.json b/chrome/common/extensions/docs/templates/json/intro_tables.json index 2bc47d64..90e19ad 100644 --- a/chrome/common/extensions/docs/templates/json/intro_tables.json +++ b/chrome/common/extensions/docs/templates/json/intro_tables.json @@ -214,7 +214,8 @@ "Learn More": [ { "link": "app_lifecycle", - "text": "Manage App Lifecycle" + "text": "Manage App Lifecycle", + "extension_types": ["platform_app"] }, { "link": "event_pages", |