File: writer_configuration.py

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (139 lines) | stat: -rwxr-xr-x 5,692 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env python3
# Copyright 2012 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.


def GetConfigurationForBuild(defines):
  '''Returns a configuration dictionary for the given build that contains
  build-specific settings and information.

  Args:
    defines: Definitions coming from the build system.

  Raises:
    Exception: If 'defines' contains an unknown build-type.
  '''
  # The prefix of key names in config determines which writer will use their
  # corresponding values:
  #   win: Both ADM and ADMX.
  #   mac: Only plist.
  #   admx: Only ADMX.
  #   adm: Only ADM.
  #   none/other: Used by all the writers.
  # Google:Cat_Google references the external google.admx file.
  # category_path_strings strings in curly braces are looked up from localized
  # 'messages' in policy_templates.json.
  if '_chromium' in defines:
    config = {
        'build': 'chromium',
        'app_name': 'Chromium',
        'doc_url': 'https://chromeenterprise.google/policies/',
        'frame_name': 'Chromium Frame',
        'os_name': 'ChromiumOS',
        'webview_name': 'Chromium WebView',
        'win_config': {
            'win': {
                'reg_mandatory_key_name': 'Software\\Policies\\Chromium',
                'reg_recommended_key_name':
                'Software\\Policies\\Chromium\\Recommended',
                'mandatory_category_path': ['chromium'],
                'recommended_category_path': ['chromium_recommended'],
                'category_path_strings': {
                    'chromium': 'Chromium',
                    'chromium_recommended': 'Chromium - {doc_recommended}',
                },
                'namespace': 'Chromium.Policies.Chromium',
            },
            'chrome_os': {
                'reg_mandatory_key_name': 'Software\\Policies\\ChromiumOS',
                'reg_recommended_key_name':
                'Software\\Policies\\ChromiumOS\\Recommended',
                'mandatory_category_path': ['chromium_os'],
                'recommended_category_path': ['chromium_os_recommended'],
                'category_path_strings': {
                    'chromium_os': 'ChromiumOS',
                    'chromium_os_recommended': 'ChromiumOS - {doc_recommended}',
                },
                'namespace': 'Chromium.Policies.ChromiumOS'
            },
        },
        'admx_prefix': 'chromium',
        'linux_policy_path': '/etc/chromium/policies/',
        'bundle_id': 'org.chromium',
    }
  elif '_google_chrome' in defines or '_is_chrome_for_testing_branded' in defines:
    if '_google_chrome' in defines:
      linux_policy_path = '/etc/opt/chrome/policies/'
      win_policy_path = 'Software\\Policies\\Google\\Chrome'
    else:
      linux_policy_path = '/etc/opt/chrome_for_testing/policies/'
      win_policy_path = 'Software\\Policies\\Google\\Chrome for Testing'
    config = {
        'build': 'chrome',
        'app_name': 'Google Chrome',
        'doc_url': 'https://chromeenterprise.google/policies/',
        'frame_name': 'Google Chrome Frame',
        'os_name': 'Google ChromeOS',
        'webview_name': 'Android System WebView',
        'win_config': {
            'win': {
                'reg_mandatory_key_name':
                win_policy_path,
                'reg_recommended_key_name':
                win_policy_path + '\\Recommended',
                'mandatory_category_path':
                ['Google:Cat_Google', 'googlechrome'],
                'recommended_category_path':
                ['Google:Cat_Google', 'googlechrome_recommended'],
                'category_path_strings': {
                    'googlechrome': 'Google Chrome',
                    'googlechrome_recommended':
                    'Google Chrome - {doc_recommended}'
                },
                'namespace':
                'Google.Policies.Chrome',
            },
            'chrome_os': {
                'reg_mandatory_key_name':
                'Software\\Policies\\Google\\ChromeOS',
                'reg_recommended_key_name':
                'Software\\Policies\\Google\\ChromeOS\\Recommended',
                'mandatory_category_path':
                ['Google:Cat_Google', 'googlechromeos'],
                'recommended_category_path':
                ['Google:Cat_Google', 'googlechromeos_recommended'],
                'category_path_strings': {
                    'googlechromeos':
                    'Google ChromeOS',
                    'googlechromeos_recommended':
                    'Google ChromeOS - {doc_recommended}'
                },
                'namespace':
                'Google.Policies.ChromeOS',
            },
        },
        # The string 'Google' is defined in google.adml for ADMX, but ADM
        # doesn't support external references, so we define this map here.
        'adm_category_path_strings': {
            'Google:Cat_Google': 'Google'
        },
        'admx_prefix': 'chrome',
        'admx_using_namespaces': {
            'Google': 'Google.Policies'  # prefix: namespace
        },
        'linux_policy_path': linux_policy_path,
        'bundle_id': 'com.google.chrome.ios',
    }
  else:
    raise Exception('Unknown build')
  if 'version' in defines:
    config['version'] = defines['version']
  if 'major_version' in defines:
    config['major_version'] = defines['major_version']
  config['win_supported_os'] = 'SUPPORTED_WIN7'
  config['win_supported_os_win7'] = 'SUPPORTED_WIN7_ONLY'
  if 'mac_bundle_id' in defines:
    config['mac_bundle_id'] = defines['mac_bundle_id']
  config['android_webview_restriction_prefix'] = 'com.android.browser:'
  return config