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

Side by Side Diff: tools/json_schema_compiler/idl_schema.py

Issue 11574006: Implement chrome.downloads.onDeterminingFilename() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r185803 Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/api_test/downloads_split/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import itertools 6 import itertools
7 import json 7 import json
8 import os.path 8 import os.path
9 import re 9 import re
10 import sys 10 import sys
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ''' 157 '''
158 def __init__(self, member_node): 158 def __init__(self, member_node):
159 self.node = member_node 159 self.node = member_node
160 160
161 def process(self, callbacks): 161 def process(self, callbacks):
162 properties = OrderedDict() 162 properties = OrderedDict()
163 name = self.node.GetName() 163 name = self.node.GetName()
164 for property_name in ('OPTIONAL', 'nodoc', 'nocompile', 'nodart'): 164 for property_name in ('OPTIONAL', 'nodoc', 'nocompile', 'nodart'):
165 if self.node.GetProperty(property_name): 165 if self.node.GetProperty(property_name):
166 properties[property_name.lower()] = True 166 properties[property_name.lower()] = True
167 for option_name, sanitizer in [
168 ('maxListeners', int),
169 ('supportsFilters', lambda s: s == 'true'),
170 ('supportsListeners', lambda s: s == 'true'),
171 ('supportsRules', lambda s: s == 'true')]:
172 if self.node.GetProperty(option_name):
173 if 'options' not in properties:
174 properties['options'] = {}
175 properties['options'][option_name] = sanitizer(self.node.GetProperty(
176 option_name))
167 is_function = False 177 is_function = False
168 parameter_comments = OrderedDict() 178 parameter_comments = OrderedDict()
169 for node in self.node.children: 179 for node in self.node.children:
170 if node.cls == 'Comment': 180 if node.cls == 'Comment':
171 (parent_comment, parameter_comments) = ProcessComment(node.GetName()) 181 (parent_comment, parameter_comments) = ProcessComment(node.GetName())
172 properties['description'] = parent_comment 182 properties['description'] = parent_comment
173 elif node.cls == 'Callspec': 183 elif node.cls == 'Callspec':
174 is_function = True 184 is_function = True
175 name, parameters, return_type = (Callspec(node, parameter_comments) 185 name, parameters, return_type = (Callspec(node, parameter_comments)
176 .process(callbacks)) 186 .process(callbacks))
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 ''' 403 '''
394 Dump a json serialization of parse result for the IDL files whose names 404 Dump a json serialization of parse result for the IDL files whose names
395 were passed in on the command line. 405 were passed in on the command line.
396 ''' 406 '''
397 for filename in sys.argv[1:]: 407 for filename in sys.argv[1:]:
398 schema = Load(filename) 408 schema = Load(filename)
399 print json.dumps(schema, indent=2) 409 print json.dumps(schema, indent=2)
400 410
401 if __name__ == '__main__': 411 if __name__ == '__main__':
402 Main() 412 Main()
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/downloads_split/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698