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

Unified Diff: tools/grit/grit/format/policy_templates/writers/adm_writer.py

Issue 2509243003: Split off 'Google' category into separate ADMX/ADML files (Closed)
Patch Set: Android build fix Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: tools/grit/grit/format/policy_templates/writers/adm_writer.py
diff --git a/tools/grit/grit/format/policy_templates/writers/adm_writer.py b/tools/grit/grit/format/policy_templates/writers/adm_writer.py
index 91aeef6be557cb8393ae5ede0c8f4686592352b7..26a2a6055c0d754131908cdd54c114d02f9fc0ae 100755
--- a/tools/grit/grit/format/policy_templates/writers/adm_writer.py
+++ b/tools/grit/grit/format/policy_templates/writers/adm_writer.py
@@ -5,7 +5,7 @@
from grit.format.policy_templates.writers import template_writer
-
+import re
NEWLINE = '\r\n'
@@ -223,17 +223,18 @@ class AdmWriter(template_writer.TemplateWriter):
self._GetChromiumVersionString())
self._AddGuiString(self.config['win_supported_os'],
self.messages['win_supported_winxpsp2']['text'])
- category_path = self.config['win_mandatory_category_path']
- recommended_category_path = self.config['win_recommended_category_path']
- recommended_name = '%s - %s' % \
- (self.config['app_name'], self.messages['doc_recommended']['text'])
- if self.config['build'] == 'chrome':
- self._AddGuiString(category_path[0], 'Google')
- self._AddGuiString(category_path[1], self.config['app_name'])
- self._AddGuiString(recommended_category_path[1], recommended_name)
- elif self.config['build'] == 'chromium':
- self._AddGuiString(category_path[0], self.config['app_name'])
- self._AddGuiString(recommended_category_path[0], recommended_name)
+ categories = self.config['win_mandatory_category_path'] + \
+ self.config['win_recommended_category_path']
+ strings = self.config['win_category_path_strings'].copy()
+ if 'adm_category_path_strings' in self.config:
+ strings.update(self.config['adm_category_path_strings'])
+ for category in categories:
+ if (category in strings):
+ # Replace {...} by localized messages.
+ string = re.sub(r"\{(\w+)\}", \
+ lambda m: self.messages[m.group(1)]['text'], \
+ strings[category])
+ self._AddGuiString(category, string)
# All the policies will be written into self.policies.
# The final template text will be assembled into self.lines by
# self.EndTemplate().

Powered by Google App Engine
This is Rietveld 408576698