Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3823)

Unified Diff: chrome/common/extensions/docs/server2/api_data_source.py

Issue 375133002: Docserver: Display API features that are available to content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar changes Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/api_data_source.py
diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py
index 6fdc6f6abd6d575845b47cd4a2e6e8c866077d3c..22dc7c3b06c27545b8f6e44c95f905a22da66aa6 100644
--- a/chrome/common/extensions/docs/server2/api_data_source.py
+++ b/chrome/common/extensions/docs/server2/api_data_source.py
@@ -231,12 +231,14 @@ class _JSCModel(object):
'''
def __init__(self,
+ api_models,
namespace,
availability_finder,
json_cache,
template_cache,
features_bundle,
event_byname_future):
+ self._content_script_apis = api_models.GetContentScriptAPIs().Get()
self._availability = availability_finder.GetAPIAvailability(namespace.name)
self._current_node = _APINodeCursor(availability_finder, namespace.name)
self._api_availabilities = json_cache.GetFromFile(
@@ -492,7 +494,7 @@ class _JSCModel(object):
intro_rows = [
self._GetIntroDescriptionRow(),
self._GetIntroAvailabilityRow()
- ] + self._GetIntroDependencyRows()
+ ] + self._GetIntroDependencyRows() + self._GetIntroContentScriptRow()
# Add rows using data from intro_tables.json, overriding any existing rows
# if they share the same 'title' attribute.
@@ -522,6 +524,21 @@ class _JSCModel(object):
'version': version
}
+ def _GetIntroContentScriptRow(self):
+ content_script_support = self._content_script_apis.get(self._namespace.name)
+ if content_script_support is None:
+ return []
+ return [{
+ 'title': 'Content Scripts',
+ 'content': [{
+ 'partial': self._template_cache.GetFromFile(
+ posixpath.join(PRIVATE_TEMPLATES,
+ 'intro_tables',
+ 'content_scripts.html')).Get(),
+ 'contentScriptSupport': content_script_support
+ }]
+ }]
+
def _GetIntroDescriptionRow(self):
''' Generates the 'Description' row data for an API intro table.
'''
@@ -688,6 +705,7 @@ class APIDataSource(DataSource):
jsc_model = jsc_model_future.Get()
if jsc_model is None:
jsc_model = _JSCModel(
+ self._platform_bundle.GetAPIModels(platform),
model_future.Get(),
self._platform_bundle.GetAvailabilityFinder(platform),
self._json_cache,

Powered by Google App Engine
This is Rietveld 408576698