OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 The returned function checks if the IDL member should be enabled. | 396 The returned function checks if the IDL member should be enabled. |
397 Given extended attribute OriginTrialEnabled=FeatureName, return: | 397 Given extended attribute OriginTrialEnabled=FeatureName, return: |
398 OriginTrials::{featureName}Enabled | 398 OriginTrials::{featureName}Enabled |
399 | 399 |
400 If the OriginTrialEnabled extended attribute is found, the includes are | 400 If the OriginTrialEnabled extended attribute is found, the includes are |
401 also updated as a side-effect. | 401 also updated as a side-effect. |
402 """ | 402 """ |
403 extended_attributes = definition_or_member.extended_attributes | 403 extended_attributes = definition_or_member.extended_attributes |
404 is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes | 404 is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes |
405 | 405 |
406 if (is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes): | 406 if is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes: |
407 raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must ' | 407 raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must ' |
408 'not be specified on the same definition: ' | 408 'not be specified on the same definition: ' |
409 '%s.%s' % (definition_or_member.idl_name, definition_or_
member.name)) | 409 '%s.%s' % (definition_or_member.idl_name, definition_or_
member.name)) |
410 | 410 |
411 if is_origin_trial_enabled: | 411 if is_origin_trial_enabled: |
412 trial_name = extended_attributes['OriginTrialEnabled'] | 412 trial_name = extended_attributes['OriginTrialEnabled'] |
413 return 'OriginTrials::%sEnabled' % uncapitalize(trial_name) | 413 return 'OriginTrials::%sEnabled' % uncapitalize(trial_name) |
414 | 414 |
| 415 is_feature_policy_enabled = 'FeaturePolicy' in extended_attributes |
| 416 |
| 417 if is_feature_policy_enabled and 'RuntimeEnabled' in extended_attributes: |
| 418 raise Exception('[FeaturePolicy] and [RuntimeEnabled] must ' |
| 419 'not be specified on the same definition: ' |
| 420 '%s.%s' % (definition_or_member.idl_name, definition_or_
member.name)) |
| 421 |
| 422 if is_feature_policy_enabled: |
| 423 includes.add('bindings/core/v8/ScriptState.h') |
| 424 includes.add('platform/feature_policy/FeaturePolicy.h') |
| 425 |
| 426 trial_name = extended_attributes['FeaturePolicy'] |
| 427 return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name) |
| 428 |
415 return None | 429 return None |
416 | 430 |
417 | 431 |
418 def origin_trial_feature_name(definition_or_member): | 432 def origin_trial_feature_name(definition_or_member): |
419 extended_attributes = definition_or_member.extended_attributes | 433 extended_attributes = definition_or_member.extended_attributes |
420 if 'OriginTrialEnabled' not in extended_attributes: | 434 return extended_attributes.get('OriginTrialEnabled') or extended_attributes.
get('FeaturePolicy') |
421 return None | |
422 return extended_attributes['OriginTrialEnabled'] | |
423 | 435 |
424 | 436 |
425 def runtime_feature_name(definition_or_member): | 437 def runtime_feature_name(definition_or_member): |
426 extended_attributes = definition_or_member.extended_attributes | 438 extended_attributes = definition_or_member.extended_attributes |
427 if 'RuntimeEnabled' not in extended_attributes: | 439 if 'RuntimeEnabled' not in extended_attributes: |
428 return None | 440 return None |
429 return extended_attributes['RuntimeEnabled'] | 441 return extended_attributes['RuntimeEnabled'] |
430 | 442 |
431 | 443 |
432 # [RuntimeEnabled] | 444 # [RuntimeEnabled] |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 except StopIteration: | 644 except StopIteration: |
633 return None | 645 return None |
634 | 646 |
635 | 647 |
636 IdlInterface.indexed_property_getter = property(indexed_property_getter) | 648 IdlInterface.indexed_property_getter = property(indexed_property_getter) |
637 IdlInterface.indexed_property_setter = property(indexed_property_setter) | 649 IdlInterface.indexed_property_setter = property(indexed_property_setter) |
638 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) | 650 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) |
639 IdlInterface.named_property_getter = property(named_property_getter) | 651 IdlInterface.named_property_getter = property(named_property_getter) |
640 IdlInterface.named_property_setter = property(named_property_setter) | 652 IdlInterface.named_property_setter = property(named_property_setter) |
641 IdlInterface.named_property_deleter = property(named_property_deleter) | 653 IdlInterface.named_property_deleter = property(named_property_deleter) |
OLD | NEW |