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

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

Issue 10797039: Extensions Docs Server: devtools API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: console and audits are back Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import os.path 6 import os.path
7 import re 7 import re
8 8
9 class ParseException(Exception): 9 class ParseException(Exception):
10 """Thrown when data in the model is invalid. 10 """Thrown when data in the model is invalid.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 self.type_ = PropertyType.ARRAY 78 self.type_ = PropertyType.ARRAY
79 self.item_type = Property(self, name + "Element", json['items'], 79 self.item_type = Property(self, name + "Element", json['items'],
80 from_json=True, 80 from_json=True,
81 from_client=True) 81 from_client=True)
82 elif json.get('type') == 'string': 82 elif json.get('type') == 'string':
83 self.type_ = PropertyType.STRING 83 self.type_ = PropertyType.STRING
84 else: 84 else:
85 if not ( 85 if not (
86 'properties' in json or 86 'properties' in json or
87 'additionalProperties' in json or 87 'additionalProperties' in json or
88 'functions' in json): 88 'functions' in json or
89 'events' in json):
89 raise ParseException(self, name + " has no properties or functions") 90 raise ParseException(self, name + " has no properties or functions")
90 self.type_ = PropertyType.OBJECT 91 self.type_ = PropertyType.OBJECT
91 self.name = name 92 self.name = name
92 self.description = json.get('description') 93 self.description = json.get('description')
93 self.from_json = True 94 self.from_json = True
94 self.from_client = True 95 self.from_client = True
95 self.parent = parent 96 self.parent = parent
96 self.instance_of = json.get('isInstanceOf', None) 97 self.instance_of = json.get('isInstanceOf', None)
97 _AddFunctions(self, json) 98 _AddFunctions(self, json)
98 _AddEvents(self, json) 99 _AddEvents(self, json)
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 # handled in pure Javascript on the render process (and .: never reach 360 # handled in pure Javascript on the render process (and .: never reach
360 # C++ let alone the browser). 361 # C++ let alone the browser).
361 if property_json.get('type') == 'function': 362 if property_json.get('type') == 'function':
362 continue 363 continue
363 model.properties[name] = Property( 364 model.properties[name] = Property(
364 model, 365 model,
365 name, 366 name,
366 property_json, 367 property_json,
367 from_json=from_json, 368 from_json=from_json,
368 from_client=from_client) 369 from_client=from_client)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698