def convert_to_list(content_script_apis):
   content_script_apis_list = [csa.__dict__ for api_name, csa
                               in content_script_apis.iteritems()
                               if self._platform_bundle.GetAPICategorizer(
                                   'extensions').IsDocumented(api_name)]
   content_script_apis_list.sort(key=itemgetter('name'))
   for csa in content_script_apis_list:
     restricted_nodes = csa['restrictedTo']
     if restricted_nodes:
       restricted_nodes.sort(key=itemgetter('node'))
       MarkFirstAndLast(restricted_nodes)
     else:
       del csa['restrictedTo']
   return content_script_apis_list
Exemple #2
0
 def _GetIntroContentScriptRow(self):
     '''Generates the 'Content Script' row data for an API intro table.
 '''
     content_script_support = self._content_script_apis.get(
         self._jsc_model.name)
     if content_script_support is None:
         return []
     if content_script_support.restrictedTo:
         content_script_support.restrictedTo.sort(key=itemgetter('node'))
         MarkFirstAndLast(content_script_support.restrictedTo)
     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__
         }]
     }]