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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 index, but for string type it's unresolved. Resolving a reference is as | 653 index, but for string type it's unresolved. Resolving a reference is as |
654 simple as looking up for corresponding ID in self.id_map, and replace the | 654 simple as looking up for corresponding ID in self.id_map, and replace the |
655 old index with the mapped index. | 655 old index with the mapped index. |
656 """ | 656 """ |
657 self.schema_nodes = map(partial(self.ResolveID, 1), self.schema_nodes) | 657 self.schema_nodes = map(partial(self.ResolveID, 1), self.schema_nodes) |
658 self.property_nodes = map(partial(self.ResolveID, 1), self.property_nodes) | 658 self.property_nodes = map(partial(self.ResolveID, 1), self.property_nodes) |
659 self.properties_nodes = map(partial(self.ResolveID, 3), | 659 self.properties_nodes = map(partial(self.ResolveID, 3), |
660 self.properties_nodes) | 660 self.properties_nodes) |
661 | 661 |
662 def _WritePolicyConstantSource(policies, os, f, riskTags): | 662 def _WritePolicyConstantSource(policies, os, f, riskTags): |
663 f.write('#include "policy/policy_constants.h"\n' | 663 f.write('#include "components/policy/policy_constants.h"\n' |
664 '\n' | 664 '\n' |
665 '#include <algorithm>\n' | 665 '#include <algorithm>\n' |
666 '#include <climits>\n' | 666 '#include <climits>\n' |
667 '\n' | 667 '\n' |
668 '#include "base/logging.h"\n' | 668 '#include "base/logging.h"\n' |
669 '#include "base/memory/ptr_util.h"\n' | 669 '#include "base/memory/ptr_util.h"\n' |
670 '#include "policy/risk_tag.h"\n' | |
671 '#include "components/policy/core/common/policy_types.h"\n' | 670 '#include "components/policy/core/common/policy_types.h"\n' |
672 '#include "components/policy/core/common/schema_internal.h"\n' | 671 '#include "components/policy/core/common/schema_internal.h"\n' |
| 672 '#include "components/policy/risk_tag.h"\n' |
673 '\n' | 673 '\n' |
674 'namespace policy {\n' | 674 'namespace policy {\n' |
675 '\n') | 675 '\n') |
676 | 676 |
677 # Generate the Chrome schema. | 677 # Generate the Chrome schema. |
678 chrome_schema = { | 678 chrome_schema = { |
679 'type': 'object', | 679 'type': 'object', |
680 'properties': {}, | 680 'properties': {}, |
681 } | 681 } |
682 shared_strings = {} | 682 shared_strings = {} |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 #include "base/callback.h" | 1010 #include "base/callback.h" |
1011 #include "base/json/json_reader.h" | 1011 #include "base/json/json_reader.h" |
1012 #include "base/logging.h" | 1012 #include "base/logging.h" |
1013 #include "base/memory/ptr_util.h" | 1013 #include "base/memory/ptr_util.h" |
1014 #include "base/memory/weak_ptr.h" | 1014 #include "base/memory/weak_ptr.h" |
1015 #include "base/values.h" | 1015 #include "base/values.h" |
1016 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 1016 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
1017 #include "components/policy/core/common/external_data_fetcher.h" | 1017 #include "components/policy/core/common/external_data_fetcher.h" |
1018 #include "components/policy/core/common/policy_map.h" | 1018 #include "components/policy/core/common/policy_map.h" |
1019 #include "components/policy/core/common/policy_types.h" | 1019 #include "components/policy/core/common/policy_types.h" |
1020 #include "policy/policy_constants.h" | 1020 #include "components/policy/policy_constants.h" |
1021 #include "policy/proto/cloud_policy.pb.h" | 1021 #include "components/policy/proto/cloud_policy.pb.h" |
1022 | 1022 |
1023 using google::protobuf::RepeatedPtrField; | 1023 using google::protobuf::RepeatedPtrField; |
1024 | 1024 |
1025 namespace policy { | 1025 namespace policy { |
1026 | 1026 |
1027 namespace em = enterprise_management; | 1027 namespace em = enterprise_management; |
1028 | 1028 |
1029 std::unique_ptr<base::Value> DecodeIntegerValue( | 1029 std::unique_ptr<base::Value> DecodeIntegerValue( |
1030 google::protobuf::int64 value) { | 1030 google::protobuf::int64 value) { |
1031 if (value < std::numeric_limits<int>::min() || | 1031 if (value < std::numeric_limits<int>::min() || |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 # _WriteAppRestrictions body | 1170 # _WriteAppRestrictions body |
1171 f.write('<restrictions xmlns:android="' | 1171 f.write('<restrictions xmlns:android="' |
1172 'http://schemas.android.com/apk/res/android">\n\n') | 1172 'http://schemas.android.com/apk/res/android">\n\n') |
1173 for policy in policies: | 1173 for policy in policies: |
1174 if policy.is_supported and policy.restriction_type != 'invalid': | 1174 if policy.is_supported and policy.restriction_type != 'invalid': |
1175 WriteAppRestriction(policy) | 1175 WriteAppRestriction(policy) |
1176 f.write('</restrictions>') | 1176 f.write('</restrictions>') |
1177 | 1177 |
1178 if __name__ == '__main__': | 1178 if __name__ == '__main__': |
1179 sys.exit(main()) | 1179 sys.exit(main()) |
OLD | NEW |