| OLD | NEW |
| 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 '''python %prog [options] platform chromium_os_flag template | 6 '''python %prog [options] platform chromium_os_flag template |
| 7 | 7 |
| 8 platform specifies which platform source is being generated for | 8 platform specifies which platform source is being generated for |
| 9 and can be one of (win, mac, linux) | 9 and can be one of (win, mac, linux) |
| 10 chromium_os_flag should be 1 if this is a Chromium OS build | 10 chromium_os_flag should be 1 if this is a Chromium OS build |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 valid_tags): | 67 valid_tags): |
| 68 self.id = policy['id'] | 68 self.id = policy['id'] |
| 69 self.name = policy['name'] | 69 self.name = policy['name'] |
| 70 self.tags = policy.get('tags', None) | 70 self.tags = policy.get('tags', None) |
| 71 self._CheckTagsValidity(valid_tags) | 71 self._CheckTagsValidity(valid_tags) |
| 72 features = policy.get('features', {}) | 72 features = policy.get('features', {}) |
| 73 self.can_be_recommended = features.get('can_be_recommended', False) | 73 self.can_be_recommended = features.get('can_be_recommended', False) |
| 74 self.can_be_mandatory = features.get('can_be_mandatory', True) | 74 self.can_be_mandatory = features.get('can_be_mandatory', True) |
| 75 self.is_deprecated = policy.get('deprecated', False) | 75 self.is_deprecated = policy.get('deprecated', False) |
| 76 self.is_device_only = policy.get('device_only', False) | 76 self.is_device_only = policy.get('device_only', False) |
| 77 self.is_future = policy.get('future', False) |
| 77 self.schema = policy.get('schema', {}) | 78 self.schema = policy.get('schema', {}) |
| 78 self.has_enterprise_default = 'default_for_enterprise_users' in policy | 79 self.has_enterprise_default = 'default_for_enterprise_users' in policy |
| 79 if self.has_enterprise_default: | 80 if self.has_enterprise_default: |
| 80 self.enterprise_default = policy['default_for_enterprise_users'] | 81 self.enterprise_default = policy['default_for_enterprise_users'] |
| 81 | 82 |
| 82 expected_platform = 'chrome_os' if is_chromium_os else os.lower() | 83 expected_platform = 'chrome_os' if is_chromium_os else os.lower() |
| 83 self.platforms = [] | 84 self.platforms = [] |
| 84 for platform, version_range in [ p.split(':') | 85 for platform, version_range in [ p.split(':') |
| 85 for p in policy['supported_on'] ]: | 86 for p in policy['supported_on'] ]: |
| 86 if self.is_device_only and platform != 'chrome_os': | 87 if self.is_device_only and platform != 'chrome_os': |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 if policy.items is not None: | 1165 if policy.items is not None: |
| 1165 WriteItemsDefinition(policy_name) | 1166 WriteItemsDefinition(policy_name) |
| 1166 | 1167 |
| 1167 f.write(' android:restrictionType="%s"/>' % policy.restriction_type) | 1168 f.write(' android:restrictionType="%s"/>' % policy.restriction_type) |
| 1168 f.write('\n\n') | 1169 f.write('\n\n') |
| 1169 | 1170 |
| 1170 # _WriteAppRestrictions body | 1171 # _WriteAppRestrictions body |
| 1171 f.write('<restrictions xmlns:android="' | 1172 f.write('<restrictions xmlns:android="' |
| 1172 'http://schemas.android.com/apk/res/android">\n\n') | 1173 'http://schemas.android.com/apk/res/android">\n\n') |
| 1173 for policy in policies: | 1174 for policy in policies: |
| 1174 if policy.is_supported and policy.restriction_type != 'invalid': | 1175 if (policy.is_supported and policy.restriction_type != 'invalid' and |
| 1176 not policy.is_deprecated and not policy.is_future): |
| 1175 WriteAppRestriction(policy) | 1177 WriteAppRestriction(policy) |
| 1176 f.write('</restrictions>') | 1178 f.write('</restrictions>') |
| 1177 | 1179 |
| 1178 if __name__ == '__main__': | 1180 if __name__ == '__main__': |
| 1179 sys.exit(main()) | 1181 sys.exit(main()) |
| OLD | NEW |