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

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

Issue 307993005: Enable the ManagedBookmarks policy on all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « components/policy/resources/policy_templates.json ('k') | components/policy_strings.grdp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 return self.GetSimpleType(schema['type']) 413 return self.GetSimpleType(schema['type'])
414 elif 'enum' in schema: 414 elif 'enum' in schema:
415 return self.GetEnumType(schema, name) 415 return self.GetEnumType(schema, name)
416 elif 'pattern' in schema: 416 elif 'pattern' in schema:
417 return self.GetPatternType(schema, name) 417 return self.GetPatternType(schema, name)
418 else: 418 else:
419 return self.GetRangedType(schema, name) 419 return self.GetRangedType(schema, name)
420 420
421 if schema['type'] == 'array': 421 if schema['type'] == 'array':
422 # Special case for lists of strings, which is a common policy type. 422 # Special case for lists of strings, which is a common policy type.
423 if schema['items']['type'] == 'string': 423 # The 'type' may be missing if the schema has a '$ref' attribute.
424 if schema['items'].get('type', '') == 'string':
424 return self.GetStringList() 425 return self.GetStringList()
425 return self.AppendSchema('TYPE_LIST', 426 return self.AppendSchema('TYPE_LIST',
426 self.GenerateAndCollectID(schema['items'], 'items of ' + name)) 427 self.GenerateAndCollectID(schema['items'], 'items of ' + name))
427 elif schema['type'] == 'object': 428 elif schema['type'] == 'object':
428 # Reserve an index first, so that dictionaries come before their 429 # Reserve an index first, so that dictionaries come before their
429 # properties. This makes sure that the root node is the first in the 430 # properties. This makes sure that the root node is the first in the
430 # SchemaNodes array. 431 # SchemaNodes array.
431 index = self.AppendSchema('TYPE_DICTIONARY', -1) 432 index = self.AppendSchema('TYPE_DICTIONARY', -1)
432 433
433 if 'additionalProperties' in schema: 434 if 'additionalProperties' in schema:
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 def _WriteCloudPolicyDecoder(policies, os, f): 918 def _WriteCloudPolicyDecoder(policies, os, f):
918 f.write(CPP_HEAD) 919 f.write(CPP_HEAD)
919 for policy in policies: 920 for policy in policies:
920 if policy.is_supported and not policy.is_device_only: 921 if policy.is_supported and not policy.is_device_only:
921 _WritePolicyCode(f, policy) 922 _WritePolicyCode(f, policy)
922 f.write(CPP_FOOT) 923 f.write(CPP_FOOT)
923 924
924 925
925 if __name__ == '__main__': 926 if __name__ == '__main__':
926 sys.exit(main()) 927 sys.exit(main())
OLDNEW
« no previous file with comments | « components/policy/resources/policy_templates.json ('k') | components/policy_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698