Home | History | Annotate | Download | only in policy_templates
      1 #!/usr/bin/env python
      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
      4 # found in the LICENSE file.
      5 
      6 
      7 def GetConfigurationForBuild(defines):
      8   '''Returns a configuration dictionary for the given build that contains
      9   build-specific settings and information.
     10 
     11   Args:
     12     defines: Definitions coming from the build system.
     13 
     14   Raises:
     15     Exception: If 'defines' contains an unknown build-type.
     16   '''
     17   # The prefix of key names in config determines which writer will use their
     18   # corresponding values:
     19   #   win: Both ADM and ADMX.
     20   #   mac: Only plist.
     21   #   admx: Only ADMX.
     22   #   none/other: Used by all the writers.
     23   if '_chromium' in defines:
     24     config = {
     25       'build': 'chromium',
     26       'app_name': 'Chromium',
     27       'frame_name': 'Chromium Frame',
     28       'os_name': 'Chromium OS',
     29       'win_reg_mandatory_key_name': 'Software\\Policies\\Chromium',
     30       'win_reg_recommended_key_name':
     31           'Software\\Policies\\Chromium\\Recommended',
     32       'win_mandatory_category_path': ['chromium'],
     33       'win_recommended_category_path': ['chromium_recommended'],
     34       'admx_namespace': 'Chromium.Policies.Chromium',
     35       'admx_prefix': 'chromium',
     36     }
     37   elif '_google_chrome' in defines:
     38     config = {
     39       'build': 'chrome',
     40       'app_name': 'Google Chrome',
     41       'frame_name': 'Google Chrome Frame',
     42       'os_name': 'Google Chrome OS',
     43       'win_reg_mandatory_key_name': 'Software\\Policies\\Google\\Chrome',
     44       'win_reg_recommended_key_name':
     45           'Software\\Policies\\Google\\Chrome\\Recommended',
     46       'win_mandatory_category_path': ['google', 'googlechrome'],
     47       'win_recommended_category_path': ['google', 'googlechrome_recommended'],
     48       'admx_namespace': 'Google.Policies.Chrome',
     49       'admx_prefix': 'chrome',
     50     }
     51   else:
     52     raise Exception('Unknown build')
     53   config['win_group_policy_class'] = 'Both'
     54   config['win_supported_os'] = 'SUPPORTED_WINXPSP2'
     55   if 'mac_bundle_id' in defines:
     56     config['mac_bundle_id'] = defines['mac_bundle_id']
     57   return config
     58