| OLD | NEW |
| 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 json | 7 import json |
| 8 from xml.dom import minidom | 8 from xml.dom import minidom |
| 9 from grit import lazy_re | 9 from grit import lazy_re |
| 10 from grit.format.policy_templates.writers import xml_formatted_writer | 10 from grit.format.policy_templates.writers import xml_formatted_writer |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 'win_reg_loc', | 512 'win_reg_loc', |
| 513 key_name + '\\' + policy['name'], | 513 key_name + '\\' + policy['name'], |
| 514 ['.monospace']) | 514 ['.monospace']) |
| 515 if (self.IsPolicySupportedOnPlatform(policy, 'linux') or | 515 if (self.IsPolicySupportedOnPlatform(policy, 'linux') or |
| 516 self.IsPolicySupportedOnPlatform(policy, 'mac')): | 516 self.IsPolicySupportedOnPlatform(policy, 'mac')): |
| 517 self._AddPolicyAttribute( | 517 self._AddPolicyAttribute( |
| 518 dl, | 518 dl, |
| 519 'mac_linux_pref_name', | 519 'mac_linux_pref_name', |
| 520 policy['name'], | 520 policy['name'], |
| 521 ['.monospace']) | 521 ['.monospace']) |
| 522 if self.IsPolicySupportedOnPlatform(policy, 'android'): | 522 if self.IsPolicySupportedOnPlatform(policy, 'android', 'chrome'): |
| 523 self._AddPolicyAttribute( | 523 self._AddPolicyAttribute( |
| 524 dl, | 524 dl, |
| 525 'android_restriction_name', | 525 'android_restriction_name', |
| 526 policy['name'], | 526 policy['name'], |
| 527 ['.monospace']) | 527 ['.monospace']) |
| 528 if self.IsPolicySupportedOnPlatform(policy, 'android', 'webview'): |
| 529 restriction_prefix = self.config['android_webview_restriction_prefix'] |
| 530 self._AddPolicyAttribute( |
| 531 dl, |
| 532 'android_webview_restriction_name', |
| 533 restriction_prefix + policy['name'], |
| 534 ['.monospace']) |
| 528 dd = self._AddPolicyAttribute(dl, 'supported_on') | 535 dd = self._AddPolicyAttribute(dl, 'supported_on') |
| 529 self._AddSupportedOnList(dd, policy['supported_on']) | 536 self._AddSupportedOnList(dd, policy['supported_on']) |
| 530 dd = self._AddPolicyAttribute(dl, 'supported_features') | 537 dd = self._AddPolicyAttribute(dl, 'supported_features') |
| 531 self._AddFeatures(dd, policy) | 538 self._AddFeatures(dd, policy) |
| 532 dd = self._AddPolicyAttribute(dl, 'description') | 539 dd = self._AddPolicyAttribute(dl, 'description') |
| 533 self._AddDescription(dd, policy) | 540 self._AddDescription(dd, policy) |
| 534 if (self.IsPolicySupportedOnPlatform(policy, 'win') or | 541 if (self.IsPolicySupportedOnPlatform(policy, 'win') or |
| 535 self.IsPolicySupportedOnPlatform(policy, 'linux') or | 542 self.IsPolicySupportedOnPlatform(policy, 'linux') or |
| 536 self.IsPolicySupportedOnPlatform(policy, 'android') or | 543 self.IsPolicySupportedOnPlatform(policy, 'android') or |
| 537 self.IsPolicySupportedOnPlatform(policy, 'mac')): | 544 self.IsPolicySupportedOnPlatform(policy, 'mac')): |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 'linux': 'Linux', | 685 'linux': 'Linux', |
| 679 'chrome_os': self.config['os_name'], | 686 'chrome_os': self.config['os_name'], |
| 680 'android': 'Android', | 687 'android': 'Android', |
| 681 'ios': 'iOS', | 688 'ios': 'iOS', |
| 682 } | 689 } |
| 683 # Human-readable names of supported products. | 690 # Human-readable names of supported products. |
| 684 self._PRODUCT_MAP = { | 691 self._PRODUCT_MAP = { |
| 685 'chrome': self.config['app_name'], | 692 'chrome': self.config['app_name'], |
| 686 'chrome_frame': self.config['frame_name'], | 693 'chrome_frame': self.config['frame_name'], |
| 687 'chrome_os': self.config['os_name'], | 694 'chrome_os': self.config['os_name'], |
| 695 'webview': self.config['webview_name'], |
| 688 } | 696 } |
| 689 # Human-readable names of supported features. Each supported feature has | 697 # Human-readable names of supported features. Each supported feature has |
| 690 # a 'doc_feature_X' entry in |self.messages|. | 698 # a 'doc_feature_X' entry in |self.messages|. |
| 691 self._FEATURE_MAP = {} | 699 self._FEATURE_MAP = {} |
| 692 for message in self.messages: | 700 for message in self.messages: |
| 693 if message.startswith('doc_feature_'): | 701 if message.startswith('doc_feature_'): |
| 694 self._FEATURE_MAP[message[12:]] = self.messages[message]['text'] | 702 self._FEATURE_MAP[message[12:]] = self.messages[message]['text'] |
| 695 # Human-readable names of types. | 703 # Human-readable names of types. |
| 696 self._TYPE_MAP = { | 704 self._TYPE_MAP = { |
| 697 'string': 'String', | 705 'string': 'String', |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 'div.group_desc': 'margin-top: 20px; margin-bottom: 20px;', | 747 'div.group_desc': 'margin-top: 20px; margin-bottom: 20px;', |
| 740 'ul': 'padding-left: 0px; margin-left: 0px;' | 748 'ul': 'padding-left: 0px; margin-left: 0px;' |
| 741 } | 749 } |
| 742 | 750 |
| 743 | 751 |
| 744 def GetTemplateText(self): | 752 def GetTemplateText(self): |
| 745 # Return the text representation of the main <div> tag. | 753 # Return the text representation of the main <div> tag. |
| 746 return self._main_div.toxml() | 754 return self._main_div.toxml() |
| 747 # To get a complete HTML file, use the following. | 755 # To get a complete HTML file, use the following. |
| 748 # return self._doc.toxml() | 756 # return self._doc.toxml() |
| OLD | NEW |