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

Side by Side Diff: components/policy/tools/template_writers/writers/plist_strings_writer.py

Issue 2653823006: Include 'external' policies in grit output (admx, adm, doc etc.) (Closed)
Patch Set: Whitespace fix Created 3 years, 3 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 6
7 from writers import plist_helper 7 from writers import plist_helper
8 from writers import template_writer 8 from writers import template_writer
9 9
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 return self.FlattenGroupsAndSortPolicies(policy_list) 45 return self.FlattenGroupsAndSortPolicies(policy_list)
46 46
47 def WritePolicy(self, policy): 47 def WritePolicy(self, policy):
48 '''Add strings to the stringtable corresponding a given policy. 48 '''Add strings to the stringtable corresponding a given policy.
49 49
50 Args: 50 Args:
51 policy: The policy for which the strings will be added to the 51 policy: The policy for which the strings will be added to the
52 string table. 52 string table.
53 ''' 53 '''
54 desc = policy['desc'] 54 desc = policy['desc']
55 if policy['type'] == 'external': 55 if policy['type'] in ('int-enum','string-enum', 'string-enum-list'):
56 # This type can only be set through cloud policy.
57 return
58 elif policy['type'] in ('int-enum','string-enum', 'string-enum-list'):
59 # Append the captions of enum items to the description string. 56 # Append the captions of enum items to the description string.
60 item_descs = [] 57 item_descs = []
61 for item in policy['items']: 58 for item in policy['items']:
62 item_descs.append(str(item['value']) + ' - ' + item['caption']) 59 item_descs.append(str(item['value']) + ' - ' + item['caption'])
63 desc = '\n'.join(item_descs) + '\n' + desc 60 desc = '\n'.join(item_descs) + '\n' + desc
64 61
65 self._AddToStringTable(policy['name'], policy['label'], desc) 62 self._AddToStringTable(policy['name'], policy['label'], desc)
66 63
67 def BeginTemplate(self): 64 def BeginTemplate(self):
68 app_name = plist_helper.GetPlistFriendlyName(self.config['app_name']) 65 app_name = plist_helper.GetPlistFriendlyName(self.config['app_name'])
69 if self._GetChromiumVersionString() is not None: 66 if self._GetChromiumVersionString() is not None:
70 self.WriteComment(self.config['build'] + ''' version: ''' + \ 67 self.WriteComment(self.config['build'] + ''' version: ''' + \
71 self._GetChromiumVersionString()) 68 self._GetChromiumVersionString())
72 self._AddToStringTable( 69 self._AddToStringTable(
73 app_name, 70 app_name,
74 self.config['app_name'], 71 self.config['app_name'],
75 self.messages['mac_chrome_preferences']['text']) 72 self.messages['mac_chrome_preferences']['text'])
76 73
77 def Init(self): 74 def Init(self):
78 # A buffer for the lines of the string table being generated. 75 # A buffer for the lines of the string table being generated.
79 self._out = [] 76 self._out = []
80 77
81 def GetTemplateText(self): 78 def GetTemplateText(self):
82 return '\n'.join(self._out) 79 return '\n'.join(self._out)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698