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 def GetConfigurationForBuild(defines): | 7 def GetConfigurationForBuild(defines): |
8 '''Returns a configuration dictionary for the given build that contains | 8 '''Returns a configuration dictionary for the given build that contains |
9 build-specific settings and information. | 9 build-specific settings and information. |
10 | 10 |
11 Args: | 11 Args: |
12 defines: Definitions coming from the build system. | 12 defines: Definitions coming from the build system. |
13 | 13 |
14 Raises: | 14 Raises: |
15 Exception: If 'defines' contains an unknown build-type. | 15 Exception: If 'defines' contains an unknown build-type. |
16 ''' | 16 ''' |
17 # The prefix of key names in config determines which writer will use their | 17 # The prefix of key names in config determines which writer will use their |
18 # corresponding values: | 18 # corresponding values: |
19 # win: Both ADM and ADMX. | 19 # win: Both ADM and ADMX. |
20 # mac: Only plist. | 20 # mac: Only plist. |
21 # admx: Only ADMX. | 21 # admx: Only ADMX. |
22 # adm: Only ADM. | 22 # adm: Only ADM. |
23 # none/other: Used by all the writers. | 23 # none/other: Used by all the writers. |
| 24 # Google:Cat_Google references the external google.admx file. |
| 25 # category_path_strings strings in curly braces are looked up from localized |
| 26 # 'messages' in policy_templates.json. |
24 if '_chromium' in defines: | 27 if '_chromium' in defines: |
25 config = { | 28 config = { |
26 'build': 'chromium', | 29 'build': 'chromium', |
27 'app_name': 'Chromium', | 30 'app_name': 'Chromium', |
28 'frame_name': 'Chromium Frame', | 31 'frame_name': 'Chromium Frame', |
29 'os_name': 'Chromium OS', | 32 'os_name': 'Chromium OS', |
30 'webview_name': 'Chromium WebView', | 33 'webview_name': 'Chromium WebView', |
31 'win_reg_mandatory_key_name': 'Software\\Policies\\Chromium', | 34 'win_config' : { |
32 'win_reg_recommended_key_name': | 35 'win' : { |
33 'Software\\Policies\\Chromium\\Recommended', | 36 'reg_mandatory_key_name': |
34 'win_mandatory_category_path': ['chromium'], | 37 'Software\\Policies\\Chromium', |
35 'win_recommended_category_path': ['chromium_recommended'], | 38 'reg_recommended_key_name': |
36 'win_category_path_strings': { | 39 'Software\\Policies\\Chromium\\Recommended', |
37 'chromium': 'Chromium', | 40 'mandatory_category_path': ['chromium'], |
38 'chromium_recommended': 'Chromium - {doc_recommended}' | 41 'recommended_category_path': ['chromium_recommended'], |
| 42 'category_path_strings': { |
| 43 'chromium': 'Chromium', |
| 44 'chromium_recommended': 'Chromium - {doc_recommended}', |
| 45 }, |
| 46 'namespace': 'Chromium.Policies.Chromium', |
| 47 }, |
| 48 'chrome_os' : { |
| 49 'reg_mandatory_key_name': |
| 50 'Software\\Policies\\ChromiumOS', |
| 51 'reg_recommended_key_name': |
| 52 'Software\\Policies\\ChromiumOS\\Recommended', |
| 53 'mandatory_category_path': ['chromium_os'], |
| 54 'recommended_category_path': ['chromium_os_recommended'], |
| 55 'category_path_strings': { |
| 56 'chromium_os': 'Chromium OS', |
| 57 'chromium_os_recommended': 'Chromium OS - {doc_recommended}', |
| 58 }, |
| 59 'namespace': 'Chromium.Policies.ChromiumOS' |
| 60 }, |
39 }, | 61 }, |
40 'admx_namespace': 'Chromium.Policies.Chromium', | |
41 'admx_prefix': 'chromium', | 62 'admx_prefix': 'chromium', |
42 'linux_policy_path': '/etc/chromium/policies/', | 63 'linux_policy_path': '/etc/chromium/policies/', |
43 } | 64 } |
44 elif '_google_chrome' in defines: | 65 elif '_google_chrome' in defines: |
45 config = { | 66 config = { |
46 'build': 'chrome', | 67 'build': 'chrome', |
47 'app_name': 'Google Chrome', | 68 'app_name': 'Google Chrome', |
48 'frame_name': 'Google Chrome Frame', | 69 'frame_name': 'Google Chrome Frame', |
49 'os_name': 'Google Chrome OS', | 70 'os_name': 'Google Chrome OS', |
50 'webview_name': 'Android System WebView', | 71 'webview_name': 'Android System WebView', |
51 'win_reg_mandatory_key_name': 'Software\\Policies\\Google\\Chrome', | 72 'win_config' : { |
52 'win_reg_recommended_key_name': | 73 'win' : { |
53 'Software\\Policies\\Google\\Chrome\\Recommended', | 74 'reg_mandatory_key_name': |
54 # Note: Google:Cat_Google references Google.Policies from external | 75 'Software\\Policies\\Google\\Chrome', |
55 # in google.admx file. | 76 'reg_recommended_key_name': |
56 'win_mandatory_category_path': ['Google:Cat_Google', 'googlechrome'], | 77 'Software\\Policies\\Google\\Chrome\\Recommended', |
57 'win_recommended_category_path': | 78 'mandatory_category_path': ['Google:Cat_Google', 'googlechrome'], |
58 ['Google:Cat_Google', 'googlechrome_recommended'], | 79 'recommended_category_path': |
59 'win_category_path_strings': { | 80 ['Google:Cat_Google', 'googlechrome_recommended'], |
60 # Strings in curly braces is looked up from localized 'messages' in | 81 'category_path_strings': { |
61 # policy_templates.json. | 82 'googlechrome': 'Google Chrome', |
62 'googlechrome': 'Google Chrome', | 83 'googlechrome_recommended': 'Google Chrome - {doc_recommended}' |
63 'googlechrome_recommended': 'Google Chrome - {doc_recommended}' | 84 }, |
| 85 'namespace': 'Google.Policies.Chrome', |
| 86 }, |
| 87 'chrome_os' : { |
| 88 'reg_mandatory_key_name': |
| 89 'Software\\Policies\\Google\\ChromeOS', |
| 90 'reg_recommended_key_name': |
| 91 'Software\\Policies\\Google\\ChromeOS\\Recommended', |
| 92 'mandatory_category_path': ['Google:Cat_Google', 'googlechromeos'], |
| 93 'recommended_category_path': |
| 94 ['Google:Cat_Google', 'googlechromeos_recommended'], |
| 95 'category_path_strings': { |
| 96 'googlechromeos': 'Google Chrome OS', |
| 97 'googlechromeos_recommended': 'Google Chrome OS - {doc_recommended}' |
| 98 }, |
| 99 'namespace': 'Google.Policies.ChromeOS', |
| 100 }, |
64 }, | 101 }, |
65 # The string 'Google' is defined in google.adml for ADMX, but ADM doesn't | 102 # The string 'Google' is defined in google.adml for ADMX, but ADM doesn't |
66 # support external references, so we define this map here. | 103 # support external references, so we define this map here. |
67 'adm_category_path_strings': { 'Google:Cat_Google': 'Google' }, | 104 'adm_category_path_strings': {'Google:Cat_Google': 'Google'}, |
68 'admx_namespace': 'Google.Policies.Chrome', | |
69 'admx_prefix': 'chrome', | 105 'admx_prefix': 'chrome', |
70 'admx_using_namespaces': { | 106 'admx_using_namespaces': { |
71 'Google': 'Google.Policies' # prefix: namespace | 107 'Google': 'Google.Policies' # prefix: namespace |
72 }, | 108 }, |
73 'linux_policy_path': '/etc/opt/chrome/policies/', | 109 'linux_policy_path': '/etc/opt/chrome/policies/', |
74 } | 110 } |
75 else: | 111 else: |
76 raise Exception('Unknown build') | 112 raise Exception('Unknown build') |
77 if 'version' in defines: | 113 if 'version' in defines: |
78 config['version'] = defines['version'] | 114 config['version'] = defines['version'] |
79 config['win_group_policy_class'] = 'Both' | |
80 config['win_supported_os'] = 'SUPPORTED_WINXPSP2' | 115 config['win_supported_os'] = 'SUPPORTED_WINXPSP2' |
81 if 'mac_bundle_id' in defines: | 116 if 'mac_bundle_id' in defines: |
82 config['mac_bundle_id'] = defines['mac_bundle_id'] | 117 config['mac_bundle_id'] = defines['mac_bundle_id'] |
83 config['android_webview_restriction_prefix'] = 'com.android.browser:' | 118 config['android_webview_restriction_prefix'] = 'com.android.browser:' |
84 return config | 119 return config |
OLD | NEW |