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

Side by Side Diff: components/policy/tools/generate_policy_source.py

Issue 1371073003: Display material design policies grouped by tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaning and Refactoring. Created 5 years, 2 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
OLDNEW
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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 '#include "base/basictypes.h"\n' 843 '#include "base/basictypes.h"\n'
844 '\n' 844 '\n'
845 'namespace policy {\n' 845 'namespace policy {\n'
846 '\n' + \ 846 '\n' + \
847 '// The tag of a policy indicates which impact a policy can have on\n' 847 '// The tag of a policy indicates which impact a policy can have on\n'
848 '// a user\'s privacy or security. Ordered descending by impact.\n' 848 '// a user\'s privacy or security. Ordered descending by impact.\n'
849 '// The explanation of the single tags is stated in\n' 849 '// The explanation of the single tags is stated in\n'
850 '// policy_templates.json within the \'risk_tag_definitions\' tag.\n' 850 '// policy_templates.json within the \'risk_tag_definitions\' tag.\n'
851 'enum RiskTag {\n' + \ 851 'enum RiskTag {\n' + \
852 riskTagGenerator.GenerateEnum () + ',\n' 852 riskTagGenerator.GenerateEnum () + ',\n'
853 ' RISK_TAG_NONE\n' 853 ' RISK_TAG_COUNT, // This has to be second last ...\n'
854 ' RISK_TAG_NONE // ... so none-tags are not counted.\n'
854 '};\n' 855 '};\n'
855 '\n' 856 '\n'
856 '// This constant describes how many risk tags were used by the\n' 857 '// This constant describes how many risk tags were used by the\n'
857 '// policy which uses the most risk tags. \n' 858 '// policy which uses the most risk tags. \n'
858 'const size_t kMaxRiskTagCount = ' + \ 859 'const size_t kMaxRiskTagCount = ' + \
859 riskTagGenerator.GetMaxTags() + ';\n' 860 riskTagGenerator.GetMaxTags() + ';\n'
860 '\n' 861 '\n'
861 '} // namespace policy\n' 862 '} // namespace policy\n'
862 '\n' 863 '\n'
863 '#endif // CHROME_COMMON_POLICY_RISK_TAG_H_' 864 '#endif // CHROME_COMMON_POLICY_RISK_TAG_H_'
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 # _WriteAppRestrictions body 1149 # _WriteAppRestrictions body
1149 f.write('<restrictions xmlns:android="' 1150 f.write('<restrictions xmlns:android="'
1150 'http://schemas.android.com/apk/res/android">\n\n') 1151 'http://schemas.android.com/apk/res/android">\n\n')
1151 for policy in policies: 1152 for policy in policies:
1152 if policy.is_supported and policy.restriction_type != 'invalid': 1153 if policy.is_supported and policy.restriction_type != 'invalid':
1153 WriteAppRestriction(policy) 1154 WriteAppRestriction(policy)
1154 f.write('</restrictions>') 1155 f.write('</restrictions>')
1155 1156
1156 if __name__ == '__main__': 1157 if __name__ == '__main__':
1157 sys.exit(main()) 1158 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698