| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 template | 6 '''python %prog [options] platform 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 template is the path to a .json policy template file.''' | 10 template is the path to a .json policy template file.''' |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 f.write(' kPolicy' + policy_name + ",\n"); | 143 f.write(' kPolicy' + policy_name + ",\n"); |
| 144 f.write('};\n\n' | 144 f.write('};\n\n' |
| 145 '} // namespace policy\n\n' | 145 '} // namespace policy\n\n' |
| 146 '#endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_TYPE_H_\n') | 146 '#endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_TYPE_H_\n') |
| 147 | 147 |
| 148 | 148 |
| 149 #------------------ policy protobuf --------------------------------# | 149 #------------------ policy protobuf --------------------------------# |
| 150 PROTO_HEAD = ''' | 150 PROTO_HEAD = ''' |
| 151 syntax = "proto2"; | 151 syntax = "proto2"; |
| 152 | 152 |
| 153 // TODO(jkummerow): Remove this when it's no longer needed (see comment |
| 154 // inside the imported file). |
| 155 import "old_generic_format.proto"; |
| 156 |
| 153 option optimize_for = LITE_RUNTIME; | 157 option optimize_for = LITE_RUNTIME; |
| 154 | 158 |
| 155 package enterprise_management; | 159 package enterprise_management; |
| 156 | 160 |
| 157 message StringList { | 161 message StringList { |
| 158 repeated string entries = 1; | 162 repeated string entries = 1; |
| 159 } | 163 } |
| 160 | 164 |
| 161 message PolicyOptions { | 165 message PolicyOptions { |
| 162 enum PolicyMode { | 166 enum PolicyMode { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 for policy in template_file_contents['policy_definitions']: | 209 for policy in template_file_contents['policy_definitions']: |
| 206 if policy['type'] == 'group': | 210 if policy['type'] == 'group': |
| 207 for sub_policy in policy['policies']: | 211 for sub_policy in policy['policies']: |
| 208 _WritePolicyProto(f, sub_policy, fields) | 212 _WritePolicyProto(f, sub_policy, fields) |
| 209 else: | 213 else: |
| 210 _WritePolicyProto(f, policy, fields) | 214 _WritePolicyProto(f, policy, fields) |
| 211 | 215 |
| 212 f.write('// --------------------------------------------------\n' | 216 f.write('// --------------------------------------------------\n' |
| 213 '// Big wrapper PB containing the above groups.\n\n' | 217 '// Big wrapper PB containing the above groups.\n\n' |
| 214 'message CloudPolicySettings {\n') | 218 'message CloudPolicySettings {\n') |
| 219 |
| 220 # TODO(jkummerow): Remove this when old_generic_format.proto is no longer |
| 221 # imported. |
| 222 f.write( |
| 223 ' repeated enterprise_management.GenericNamedValue named_value = 2;') |
| 224 |
| 215 f.write(''.join(fields)) | 225 f.write(''.join(fields)) |
| 216 f.write('}\n\n') | 226 f.write('}\n\n') |
| 217 | 227 |
| 218 | 228 |
| 219 #------------------ protobuf decoder -------------------------------# | 229 #------------------ protobuf decoder -------------------------------# |
| 220 CPP_HEAD = ''' | 230 CPP_HEAD = ''' |
| 221 #include <limits> | 231 #include <limits> |
| 222 #include <map> | 232 #include <map> |
| 223 #include <string> | 233 #include <string> |
| 224 | 234 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 for sub_policy in policy['policies']: | 328 for sub_policy in policy['policies']: |
| 319 _WritePolicyCode(f, sub_policy) | 329 _WritePolicyCode(f, sub_policy) |
| 320 else: | 330 else: |
| 321 _WritePolicyCode(f, policy) | 331 _WritePolicyCode(f, policy) |
| 322 f.write(CPP_FOOT) | 332 f.write(CPP_FOOT) |
| 323 | 333 |
| 324 | 334 |
| 325 #------------------ main() -----------------------------------------# | 335 #------------------ main() -----------------------------------------# |
| 326 if __name__ == '__main__': | 336 if __name__ == '__main__': |
| 327 main(); | 337 main(); |
| OLD | NEW |