| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 'string': 'String', | 638 'string': 'String', |
| 639 'int': 'Integer', | 639 'int': 'Integer', |
| 640 'main': 'Boolean', | 640 'main': 'Boolean', |
| 641 'int-enum': 'Integer', | 641 'int-enum': 'Integer', |
| 642 'string-enum': 'String', | 642 'string-enum': 'String', |
| 643 'list': 'List of strings', | 643 'list': 'List of strings', |
| 644 'string-enum-list': 'List of strings', | 644 'string-enum-list': 'List of strings', |
| 645 'dict': 'Dictionary', | 645 'dict': 'Dictionary', |
| 646 'external': 'External data reference', | 646 'external': 'External data reference', |
| 647 } | 647 } |
| 648 reg_dict = 'REG_SZ; %s' % self._GetLocalizedMessage( |
| 649 'complex_policies_on_windows') |
| 648 self._REG_TYPE_MAP = { | 650 self._REG_TYPE_MAP = { |
| 649 'string': 'REG_SZ', | 651 'string': 'REG_SZ', |
| 650 'int': 'REG_DWORD', | 652 'int': 'REG_DWORD', |
| 651 'main': 'REG_DWORD', | 653 'main': 'REG_DWORD', |
| 652 'int-enum': 'REG_DWORD', | 654 'int-enum': 'REG_DWORD', |
| 653 'string-enum': 'REG_SZ', | 655 'string-enum': 'REG_SZ', |
| 654 'dict': 'REG_SZ, encoded as a JSON string', | 656 'dict': reg_dict, |
| 655 } | 657 } |
| 656 # The CSS style-sheet used for the document. It will be used in Google | 658 # The CSS style-sheet used for the document. It will be used in Google |
| 657 # Sites, which strips class attributes from HTML tags. To work around this, | 659 # Sites, which strips class attributes from HTML tags. To work around this, |
| 658 # the style-sheet is a dictionary and the style attributes will be added | 660 # the style-sheet is a dictionary and the style attributes will be added |
| 659 # "by hand" for each element. | 661 # "by hand" for each element. |
| 660 self._STYLE = { | 662 self._STYLE = { |
| 661 'table': 'border-style: none; border-collapse: collapse;', | 663 'table': 'border-style: none; border-collapse: collapse;', |
| 662 'tr': 'height: 0px;', | 664 'tr': 'height: 0px;', |
| 663 'td': 'border: 1px dotted rgb(170, 170, 170); padding: 7px; ' | 665 'td': 'border: 1px dotted rgb(170, 170, 170); padding: 7px; ' |
| 664 'vertical-align: top; width: 236px; height: 15px;', | 666 'vertical-align: top; width: 236px; height: 15px;', |
| (...skipping 10 matching lines...) Expand all Loading... |
| 675 } | 677 } |
| 676 | 678 |
| 677 # A simple regexp to search for URLs. It is enough for now. | 679 # A simple regexp to search for URLs. It is enough for now. |
| 678 self._url_matcher = lazy_re.compile('(http://[^\\s]*[^\\s\\.])') | 680 self._url_matcher = lazy_re.compile('(http://[^\\s]*[^\\s\\.])') |
| 679 | 681 |
| 680 def GetTemplateText(self): | 682 def GetTemplateText(self): |
| 681 # Return the text representation of the main <div> tag. | 683 # Return the text representation of the main <div> tag. |
| 682 return self._main_div.toxml() | 684 return self._main_div.toxml() |
| 683 # To get a complete HTML file, use the following. | 685 # To get a complete HTML file, use the following. |
| 684 # return self._doc.toxml() | 686 # return self._doc.toxml() |
| OLD | NEW |