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

Side by Side Diff: grit/format/policy_templates/policy_template_generator.py

Issue 1372953002: Add support for the 'webview_android' policy configuration (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Add policy_templates OWNERS file Created 5 years, 2 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 import copy 7 import copy
8 8
9 9
10 class PolicyTemplateGenerator: 10 class PolicyTemplateGenerator:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 into dictionaries. 56 into dictionaries.
57 57
58 Args: 58 Args:
59 supported_on: The list of supported platforms. E.g.: 59 supported_on: The list of supported platforms. E.g.:
60 ['chrome.win:8-10', 'chrome_frame:10-'] 60 ['chrome.win:8-10', 'chrome_frame:10-']
61 61
62 Returns: 62 Returns:
63 supported_on: The list with its items converted to dictionaries. E.g.: 63 supported_on: The list with its items converted to dictionaries. E.g.:
64 [{ 64 [{
65 'product': 'chrome', 65 'product': 'chrome',
66 'platform': 'win', 66 'platforms': 'win',
67 'since_version': '8', 67 'since_version': '8',
68 'until_version': '10' 68 'until_version': '10'
69 }, { 69 }, {
70 'product': 'chrome_frame', 70 'product': 'chrome_frame',
71 'platform': 'win', 71 'platforms': 'win',
72 'since_version': '10', 72 'since_version': '10',
73 'until_version': '' 73 'until_version': ''
74 }] 74 }]
75 ''' 75 '''
76 result = [] 76 result = []
77 for supported_on_item in supported_on: 77 for supported_on_item in supported_on:
78 product_platform_part, version_part = supported_on_item.split(':') 78 product_platform_part, version_part = supported_on_item.split(':')
79 79
80 if '.' in product_platform_part: 80 if '.' in product_platform_part:
81 product, platform = product_platform_part.split('.') 81 product, platform = product_platform_part.split('.')
82 if platform == '*': 82 if platform == '*':
83 # e.g.: 'chrome.*:8-10' 83 # e.g.: 'chrome.*:8-10'
84 platforms = ['linux', 'mac', 'win'] 84 platforms = ['linux', 'mac', 'win']
85 else: 85 else:
86 # e.g.: 'chrome.win:-10' 86 # e.g.: 'chrome.win:-10'
87 platforms = [platform] 87 platforms = [platform]
88 else: 88 else:
89 # e.g.: 'chrome_frame:7-' 89 # e.g.: 'chrome_frame:7-'
90 product, platform = { 90 product, platform = {
91 'android': ('chrome', 'android'), 91 'android': ('chrome', 'android'),
92 'chrome_os': ('chrome_os', 'chrome_os'), 92 'webview_android': ('webview', 'android'),
93 'chrome_frame': ('chrome_frame', 'win'), 93 'chrome_os': ('chrome_os', 'chrome_os'),
94 'ios': ('chrome', 'ios'), 94 'chrome_frame': ('chrome_frame', 'win'),
95 'ios': ('chrome', 'ios'),
95 }[product_platform_part] 96 }[product_platform_part]
96 platforms = [platform] 97 platforms = [platform]
97 since_version, until_version = version_part.split('-') 98 since_version, until_version = version_part.split('-')
98 result.append({ 99 result.append({
99 'product': product, 100 'product': product,
100 'platforms': platforms, 101 'platforms': platforms,
101 'since_version': since_version, 102 'since_version': since_version,
102 'until_version': until_version 103 'until_version': until_version
103 }) 104 })
104 return result 105 return result
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 to the constructor, using a given TemplateWriter. 146 to the constructor, using a given TemplateWriter.
146 147
147 Args: 148 Args:
148 template_writer: An object implementing TemplateWriter. Its methods 149 template_writer: An object implementing TemplateWriter. Its methods
149 are called here for each item of self._policy_groups. 150 are called here for each item of self._policy_groups.
150 151
151 Returns: 152 Returns:
152 The text of the generated template. 153 The text of the generated template.
153 ''' 154 '''
154 return template_writer.WriteTemplate(self._policy_data) 155 return template_writer.WriteTemplate(self._policy_data)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698