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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
709 creation_expression = 'new base::FundamentalValue(%s)' %\ | 709 creation_expression = 'new base::FundamentalValue(%s)' %\ |
710 policy.enterprise_default | 710 policy.enterprise_default |
711 elif policy.policy_type == 'TYPE_STRING': | 711 elif policy.policy_type == 'TYPE_STRING': |
712 creation_expression = 'new base::StringValue("%s")' %\ | 712 creation_expression = 'new base::StringValue("%s")' %\ |
713 policy.enterprise_default | 713 policy.enterprise_default |
714 else: | 714 else: |
715 raise RuntimeError('Type %s of policy %s is not supported at ' | 715 raise RuntimeError('Type %s of policy %s is not supported at ' |
716 'enterprise defaults' % (policy.policy_type, | 716 'enterprise defaults' % (policy.policy_type, |
717 policy.name)) | 717 policy.name)) |
718 f.write(' if (!policy_map->Get(key::k%s)) {\n' | 718 f.write(' if (!policy_map->Get(key::k%s)) {\n' |
719 ' policy_map->Set(key::k%s,\n' | 719 ' policy_map->SetWithSource(key::k%s,\n' |
720 ' POLICY_LEVEL_MANDATORY,\n' | 720 ' POLICY_LEVEL_MANDATORY,\n' |
721 ' POLICY_SCOPE_USER,\n' | 721 ' POLICY_SCOPE_USER,\n' |
722 ' %s,\n' | 722 ' %s,\n' |
723 ' NULL);\n' | 723 ' NULL,\n' |
bartfab (slow)
2015/09/14 14:42:28
Nit: s/NULL/nullptr/
fhorschig
2015/09/16 13:52:06
Done.
| |
724 ' ' | |
bartfab (slow)
2015/09/14 14:42:28
Nit: Remove blank line.
fhorschig
2015/09/16 13:52:06
Done.
| |
725 'POLICY_SOURCE_ENTERPRISE_DEFAULT);\n' | |
bartfab (slow)
2015/09/14 14:42:28
1: Where is |POLICY_SOURCE_ENTERPRISE_DEFAULT| com
fhorschig
2015/09/16 13:52:06
Done.
| |
724 ' }\n' % (policy.name, policy.name, creation_expression)) | 726 ' }\n' % (policy.name, policy.name, creation_expression)) |
725 | 727 |
726 f.write('}\n' | 728 f.write('}\n' |
727 '#endif\n\n') | 729 '#endif\n\n') |
728 | 730 |
729 f.write('const PolicyDetails* GetChromePolicyDetails(' | 731 f.write('const PolicyDetails* GetChromePolicyDetails(' |
730 'const std::string& policy) {\n' | 732 'const std::string& policy) {\n' |
731 ' // First index in kPropertyNodes of the Chrome policies.\n' | 733 ' // First index in kPropertyNodes of the Chrome policies.\n' |
732 ' static const int begin_index = %s;\n' | 734 ' static const int begin_index = %s;\n' |
733 ' // One-past-the-end of the Chrome policies in kPropertyNodes.\n' | 735 ' // One-past-the-end of the Chrome policies in kPropertyNodes.\n' |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 # _WriteAppRestrictions body | 1050 # _WriteAppRestrictions body |
1049 f.write('<restrictions xmlns:android="' | 1051 f.write('<restrictions xmlns:android="' |
1050 'http://schemas.android.com/apk/res/android">\n\n') | 1052 'http://schemas.android.com/apk/res/android">\n\n') |
1051 for policy in policies: | 1053 for policy in policies: |
1052 if policy.is_supported and policy.restriction_type != 'invalid': | 1054 if policy.is_supported and policy.restriction_type != 'invalid': |
1053 WriteAppRestriction(policy) | 1055 WriteAppRestriction(policy) |
1054 f.write('</restrictions>') | 1056 f.write('</restrictions>') |
1055 | 1057 |
1056 if __name__ == '__main__': | 1058 if __name__ == '__main__': |
1057 sys.exit(main()) | 1059 sys.exit(main()) |
OLD | NEW |