Revert "Always activate MojoApplicationHost"
[chromium-blink-merge.git] / tools / metrics / actions / print_style.py
blob5625669147eadd626cfc14358f5f4e0e763f99d0
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Holds the constants for pretty printing actions.xml."""
7 import os
8 import sys
10 # Import the metrics/common module for pretty print xml.
11 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
12 import pretty_print_xml
14 # Desired order for tag and tag attributes.
15 # { tag_name: [attribute_name, ...] }
16 ATTRIBUTE_ORDER = {
17 'action': ['name'],
18 'owner': [],
19 'description': [],
20 'obsolete': [],
23 # Tag names for top-level nodes whose children we don't want to indent.
24 TAGS_THAT_DONT_INDENT = ['actions']
26 # Extra vertical spacing rules for special tag names.
27 # {tag_name: (newlines_after_open, newlines_before_close, newlines_after_close)}
28 TAGS_THAT_HAVE_EXTRA_NEWLINE = {
29 'actions': (2, 1, 1),
30 'action': (1, 1, 1),
33 # Tags that we allow to be squished into a single line for brevity.
34 TAGS_THAT_ALLOW_SINGLE_LINE = ['owner', 'description', 'obsolete']
36 def GetPrintStyle():
37 """Returns an XmlStyle object for pretty printing actions."""
38 return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER,
39 TAGS_THAT_HAVE_EXTRA_NEWLINE,
40 TAGS_THAT_DONT_INDENT,
41 TAGS_THAT_ALLOW_SINGLE_LINE)