[grit-i18n] r201 committed - Add support for the 'webview_android' policy configuration...

0 views
Skip to first unread message

grit...@googlecode.com

unread,
Nov 3, 2015, 2:21:06 PM11/3/15
to grit-de...@googlegroups.com
Revision: 201
Author: tha...@chromium.org
Date: Tue Nov 3 19:20:39 2015 UTC
Log: Add support for the 'webview_android' policy configuration

Allows specifying which policies are supported on Webview.
Supported policies will display the webview restriction
name for policy 'Foo' as 'com.android.browser:Foo'

BUG=536733

Review URL: https://codereview.chromium.org/1372953002/
Patch from <d...@chromium.org>!

https://code.google.com/p/grit-i18n/source/detail?r=201

Modified:
/trunk/grit/format/policy_templates/policy_template_generator.py
/trunk/grit/format/policy_templates/writer_configuration.py
/trunk/grit/format/policy_templates/writers/doc_writer.py
/trunk/grit/format/policy_templates/writers/doc_writer_unittest.py
/trunk/grit/format/policy_templates/writers/template_writer.py

=======================================
--- /trunk/grit/format/policy_templates/policy_template_generator.py Thu
Jun 26 11:37:29 2014 UTC
+++ /trunk/grit/format/policy_templates/policy_template_generator.py Tue
Nov 3 19:20:39 2015 UTC
@@ -63,12 +63,12 @@
supported_on: The list with its items converted to dictionaries.
E.g.:
[{
'product': 'chrome',
- 'platform': 'win',
+ 'platforms': 'win',
'since_version': '8',
'until_version': '10'
}, {
'product': 'chrome_frame',
- 'platform': 'win',
+ 'platforms': 'win',
'since_version': '10',
'until_version': ''
}]
@@ -88,10 +88,11 @@
else:
# e.g.: 'chrome_frame:7-'
product, platform = {
- 'android': ('chrome', 'android'),
- 'chrome_os': ('chrome_os', 'chrome_os'),
- 'chrome_frame': ('chrome_frame', 'win'),
- 'ios': ('chrome', 'ios'),
+ 'android': ('chrome', 'android'),
+ 'webview_android': ('webview', 'android'),
+ 'chrome_os': ('chrome_os', 'chrome_os'),
+ 'chrome_frame': ('chrome_frame', 'win'),
+ 'ios': ('chrome', 'ios'),
}[product_platform_part]
platforms = [platform]
since_version, until_version = version_part.split('-')
=======================================
--- /trunk/grit/format/policy_templates/writer_configuration.py Thu Oct 16
12:01:31 2014 UTC
+++ /trunk/grit/format/policy_templates/writer_configuration.py Tue Nov 3
19:20:39 2015 UTC
@@ -26,6 +26,7 @@
'app_name': 'Chromium',
'frame_name': 'Chromium Frame',
'os_name': 'Chromium OS',
+ 'webview_name': 'Chromium WebView',
'win_reg_mandatory_key_name': 'Software\\Policies\\Chromium',
'win_reg_recommended_key_name':
'Software\\Policies\\Chromium\\Recommended',
@@ -41,6 +42,7 @@
'app_name': 'Google Chrome',
'frame_name': 'Google Chrome Frame',
'os_name': 'Google Chrome OS',
+ 'webview_name': 'Android System WebView',
'win_reg_mandatory_key_name': 'Software\\Policies\\Google\\Chrome',
'win_reg_recommended_key_name':
'Software\\Policies\\Google\\Chrome\\Recommended',
@@ -58,4 +60,5 @@
config['win_supported_os'] = 'SUPPORTED_WINXPSP2'
if 'mac_bundle_id' in defines:
config['mac_bundle_id'] = defines['mac_bundle_id']
+ config['android_webview_restriction_prefix'] = 'com.android.browser:'
return config
=======================================
--- /trunk/grit/format/policy_templates/writers/doc_writer.py Wed Mar 4
22:13:50 2015 UTC
+++ /trunk/grit/format/policy_templates/writers/doc_writer.py Tue Nov 3
19:20:39 2015 UTC
@@ -519,12 +519,19 @@
'mac_linux_pref_name',
policy['name'],
['.monospace'])
- if self.IsPolicySupportedOnPlatform(policy, 'android'):
+ if self.IsPolicySupportedOnPlatform(policy, 'android', 'chrome'):
self._AddPolicyAttribute(
dl,
'android_restriction_name',
policy['name'],
['.monospace'])
+ if self.IsPolicySupportedOnPlatform(policy, 'android', 'webview'):
+ restriction_prefix =
self.config['android_webview_restriction_prefix']
+ self._AddPolicyAttribute(
+ dl,
+ 'android_webview_restriction_name',
+ restriction_prefix + policy['name'],
+ ['.monospace'])
dd = self._AddPolicyAttribute(dl, 'supported_on')
self._AddSupportedOnList(dd, policy['supported_on'])
dd = self._AddPolicyAttribute(dl, 'supported_features')
@@ -685,6 +692,7 @@
'chrome': self.config['app_name'],
'chrome_frame': self.config['frame_name'],
'chrome_os': self.config['os_name'],
+ 'webview': self.config['webview_name'],
}
# Human-readable names of supported features. Each supported feature
has
# a 'doc_feature_X' entry in |self.messages|.
=======================================
--- /trunk/grit/format/policy_templates/writers/doc_writer_unittest.py Wed
Mar 4 22:13:50 2015 UTC
+++ /trunk/grit/format/policy_templates/writers/doc_writer_unittest.py Tue
Nov 3 19:20:39 2015 UTC
@@ -37,6 +37,8 @@
'app_name': 'Chrome',
'frame_name': 'Chrome Frame',
'os_name': 'Chrome OS',
+ 'webview_name': 'WebView',
+ 'android_webview_restriction_prefix': 'mock.prefix:',
'win_reg_mandatory_key_name': 'MockKey',
'win_reg_recommended_key_name': 'MockKeyRec',
'build': 'test_product',
@@ -58,6 +60,9 @@
'doc_android_restriction_name': {
'text': '_test_android_restriction_name'
},
+ 'doc_android_webview_restriction_name': {
+ 'text': '_test_android_webview_restriction_name'
+ },
'doc_note': {'text': '_test_note'},
'doc_name_column_title': {'text': '_test_name_column_title'},
'doc_not_supported': {'text': '_test_not_supported'},
@@ -417,6 +422,11 @@
'platforms': ['android'],
'since_version': '30',
'until_version': '',
+ }, {
+ 'product': 'webview',
+ 'platforms': ['android'],
+ 'since_version': '47',
+ 'until_version': '',
}, {
'product': 'chrome',
'platforms': ['ios'],
@@ -439,11 +449,14 @@
'<dd style="style_.monospace;">TestPolicyName</dd>'
'<dt style="style_dt;">_test_android_restriction_name</dt>'
'<dd style="style_.monospace;">TestPolicyName</dd>'
+ '<dt style="style_dt;">_test_android_webview_restriction_name</dt>'
+ '<dd style="style_.monospace;">mock.prefix:TestPolicyName</dd>'
'<dt style="style_dt;">_test_supported_on</dt>'
'<dd>'
'<ul style="style_ul;">'
'<li>Chrome (Windows, Mac, Linux) ...8...</li>'
'<li>Chrome (Android) ...30...</li>'
+ '<li>WebView (Android) ...47...</li>'
'<li>Chrome (iOS) ...34...</li>'
'</ul>'
'</dd>'
=======================================
--- /trunk/grit/format/policy_templates/writers/template_writer.py Thu Oct
16 12:01:31 2014 UTC
+++ /trunk/grit/format/policy_templates/writers/template_writer.py Tue Nov
3 19:20:39 2015 UTC
@@ -91,15 +91,20 @@
'''Checks if the given policy can be mandatory.'''
return policy.get('features', {}).get('can_be_mandatory', True)

- def IsPolicySupportedOnPlatform(self, policy, platform):
- '''Checks if |policy| is supported on |platform|.
+ def IsPolicySupportedOnPlatform(self, policy, platform, product=None):
+ '''Checks if |policy| is supported on |product| for |platform|. If not
+ specified, only the platform support is checked.

Args:
policy: The dictionary of the policy.
platform: The platform to check; one of 'win', 'mac', 'linux' or
'chrome_os'.
+ product: Optional product to check; one of 'chrome', 'chrome_frame',
+ 'chrome_os', 'webview'
'''
- is_supported = lambda x: platform in x['platforms']
+ is_supported = lambda x: (platform in x['platforms'] and
+ (not product or product in x['product']))
+
return any(filter(is_supported, policy['supported_on']))

def _GetChromiumVersionString(self):
Reply all
Reply to author
Forward
0 new messages