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

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: Rebase/Address comments 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 aaea1ab2a1e50fa4b28bc6fb70cf8be6624ab855..8bc1167065498aad1c5bdb3577dfb3d1cace2525 100644
--- a/chrome/common/extensions/docs/server2/api_data_source.py
+++ b/chrome/common/extensions/docs/server2/api_data_source.py
@@ -266,12 +266,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()
not at google - send to devlin 2014/07/16 00:32:20 come to think of it, if you pass the content scrip
self._availability = availability_finder.GetAPIAvailability(namespace.name)
self._current_node = _APINodeCursor(availability_finder, namespace.name)
self._api_availabilities = json_cache.GetFromFile(
@@ -544,7 +546,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.
@@ -574,6 +576,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.__dict__
+ }]
+ }]
+
def _GetIntroDescriptionRow(self):
''' Generates the 'Description' row data for an API intro table.
'''
@@ -740,6 +757,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