| OLD | NEW |
| 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 from json_parse import OrderedDict | 9 from json_parse import OrderedDict |
| 10 | 10 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 - |platforms| if not None, the list of platforms that the function is | 192 - |platforms| if not None, the list of platforms that the function is |
| 193 available to | 193 available to |
| 194 - |params| a list of parameters to the function (order matters). A separate | 194 - |params| a list of parameters to the function (order matters). A separate |
| 195 parameter is used for each choice of a 'choices' parameter | 195 parameter is used for each choice of a 'choices' parameter |
| 196 - |description| a description of the function (if provided) | 196 - |description| a description of the function (if provided) |
| 197 - |callback| the callback parameter to the function. There should be exactly | 197 - |callback| the callback parameter to the function. There should be exactly |
| 198 one | 198 one |
| 199 - |optional| whether the Function is "optional"; this only makes sense to be | 199 - |optional| whether the Function is "optional"; this only makes sense to be |
| 200 present when the Function is representing a callback property | 200 present when the Function is representing a callback property |
| 201 - |simple_name| the name of this Function without a namespace | 201 - |simple_name| the name of this Function without a namespace |
| 202 - |returns| the return type of the function; None if the function does not |
| 203 return a value |
| 202 """ | 204 """ |
| 203 def __init__(self, | 205 def __init__(self, |
| 204 parent, | 206 parent, |
| 205 name, | 207 name, |
| 206 json, | 208 json, |
| 207 namespace, | 209 namespace, |
| 208 origin): | 210 origin): |
| 209 self.name = name | 211 self.name = name |
| 210 self.simple_name = _StripNamespace(self.name, namespace) | 212 self.simple_name = _StripNamespace(self.name, namespace) |
| 211 self.platforms = _GetPlatforms(json) | 213 self.platforms = _GetPlatforms(json) |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 def _GetPlatforms(json): | 458 def _GetPlatforms(json): |
| 457 if 'platforms' not in json: | 459 if 'platforms' not in json: |
| 458 return None | 460 return None |
| 459 platforms = [] | 461 platforms = [] |
| 460 for platform_name in json['platforms']: | 462 for platform_name in json['platforms']: |
| 461 for platform_enum in _Enum.GetAll(Platforms): | 463 for platform_enum in _Enum.GetAll(Platforms): |
| 462 if platform_name == platform_enum.name: | 464 if platform_name == platform_enum.name: |
| 463 platforms.append(platform_enum) | 465 platforms.append(platform_enum) |
| 464 break | 466 break |
| 465 return platforms | 467 return platforms |
| OLD | NEW |