diff options
author | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-16 13:49:20 +0000 |
---|---|---|
committer | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-16 13:49:20 +0000 |
commit | 991573eea1ab5aeefb920ef46a055271713d694a (patch) | |
tree | 2383d405f522d0441452d3befe9160e968a5f35e | |
parent | 7f123d2a3dc472dd796c13e2d7d599446fe9831d (diff) | |
download | chromium_src-991573eea1ab5aeefb920ef46a055271713d694a.zip chromium_src-991573eea1ab5aeefb920ef46a055271713d694a.tar.gz chromium_src-991573eea1ab5aeefb920ef46a055271713d694a.tar.bz2 |
Move chrome/app/policy into components/policy.
This move enables using the files derived from policy_templates.json in iOS
builds. List of changes:
- cloud_policy_codegen.gyp and policy_templates.gypi have been merged into
components/policy.gypi
- policy_templates.json moved into components/policy/resources/
- policy_templates.grd and *.xtb files moved into components/policy/resources/
- syntax_check_policy_templates_json.py and
chrome/tools/build/generate_policy_source.py moved into
components/policy/tools
BUG=271392
R=jochen@chromium.org, pastarmovj@chromium.org
Review URL: https://codereview.chromium.org/108513011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240875 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | WATCHLISTS | 2 | ||||
-rw-r--r-- | build/all.gyp | 2 | ||||
-rw-r--r-- | chrome/app/policy/cloud_policy_codegen.gyp | 173 | ||||
-rw-r--r-- | chrome/app/policy/policy_templates.gypi | 168 | ||||
-rw-r--r-- | chrome/browser/policy/policy_prefs_browsertest.cc | 4 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_browser_chromeos.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_browser_extensions.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_browser_ui.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 9 | ||||
-rw-r--r-- | chrome/chrome_dll.gypi | 4 | ||||
-rw-r--r-- | chrome/chrome_dll_bundle.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_exe.gypi | 6 | ||||
-rw-r--r-- | chrome/chrome_tests_unit.gypi | 4 | ||||
-rw-r--r-- | chrome/policy.gypi | 2 | ||||
-rw-r--r-- | chrome/policy_templates.gypi | 90 | ||||
-rw-r--r-- | chrome/tools/build/OWNERS | 4 | ||||
-rw-r--r-- | chrome_frame/chrome_frame.gyp | 4 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_launcher.gyp | 2 | ||||
-rw-r--r-- | components/components_tests.gyp | 8 | ||||
-rw-r--r-- | components/policy.gypi | 343 | ||||
-rw-r--r-- | components/policy/core/DEPS | 8 | ||||
-rw-r--r-- | components/policy/core/common/cloud/DEPS | 7 | ||||
-rw-r--r-- | components/policy/core/common/policy_map.cc | 6 | ||||
-rw-r--r-- | components/policy/core/common/policy_map.h | 6 | ||||
-rw-r--r-- | components/policy/resources/OWNERS (renamed from chrome/app/policy/OWNERS) | 8 | ||||
-rw-r--r-- | components/policy/resources/PRESUBMIT.py (renamed from chrome/app/policy/PRESUBMIT.py) | 8 | ||||
-rw-r--r-- | components/policy/resources/policy_templates.grd (renamed from chrome/app/policy/policy_templates.grd) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates.json (renamed from chrome/app/policy/policy_templates.json) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_am.xtb (renamed from chrome/app/policy/policy_templates_am.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ar.xtb (renamed from chrome/app/policy/policy_templates_ar.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_bg.xtb (renamed from chrome/app/policy/policy_templates_bg.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_bn.xtb (renamed from chrome/app/policy/policy_templates_bn.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ca.xtb (renamed from chrome/app/policy/policy_templates_ca.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_cs.xtb (renamed from chrome/app/policy/policy_templates_cs.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_da.xtb (renamed from chrome/app/policy/policy_templates_da.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_de.xtb (renamed from chrome/app/policy/policy_templates_de.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_el.xtb (renamed from chrome/app/policy/policy_templates_el.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_en-GB.xtb (renamed from chrome/app/policy/policy_templates_en-GB.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_es-419.xtb (renamed from chrome/app/policy/policy_templates_es-419.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_es.xtb (renamed from chrome/app/policy/policy_templates_es.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_et.xtb (renamed from chrome/app/policy/policy_templates_et.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_fa.xtb (renamed from chrome/app/policy/policy_templates_fa.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_fi.xtb (renamed from chrome/app/policy/policy_templates_fi.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_fil.xtb (renamed from chrome/app/policy/policy_templates_fil.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_fr.xtb (renamed from chrome/app/policy/policy_templates_fr.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_gu.xtb (renamed from chrome/app/policy/policy_templates_gu.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_hi.xtb (renamed from chrome/app/policy/policy_templates_hi.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_hr.xtb (renamed from chrome/app/policy/policy_templates_hr.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_hu.xtb (renamed from chrome/app/policy/policy_templates_hu.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_id.xtb (renamed from chrome/app/policy/policy_templates_id.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_it.xtb (renamed from chrome/app/policy/policy_templates_it.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_iw.xtb (renamed from chrome/app/policy/policy_templates_iw.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ja.xtb (renamed from chrome/app/policy/policy_templates_ja.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_kn.xtb (renamed from chrome/app/policy/policy_templates_kn.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ko.xtb (renamed from chrome/app/policy/policy_templates_ko.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_lt.xtb (renamed from chrome/app/policy/policy_templates_lt.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_lv.xtb (renamed from chrome/app/policy/policy_templates_lv.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ml.xtb (renamed from chrome/app/policy/policy_templates_ml.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_mr.xtb (renamed from chrome/app/policy/policy_templates_mr.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ms.xtb (renamed from chrome/app/policy/policy_templates_ms.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_nl.xtb (renamed from chrome/app/policy/policy_templates_nl.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_no.xtb (renamed from chrome/app/policy/policy_templates_no.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_pl.xtb (renamed from chrome/app/policy/policy_templates_pl.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_pt-BR.xtb (renamed from chrome/app/policy/policy_templates_pt-BR.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_pt-PT.xtb (renamed from chrome/app/policy/policy_templates_pt-PT.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ro.xtb (renamed from chrome/app/policy/policy_templates_ro.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ru.xtb (renamed from chrome/app/policy/policy_templates_ru.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_sk.xtb (renamed from chrome/app/policy/policy_templates_sk.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_sl.xtb (renamed from chrome/app/policy/policy_templates_sl.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_sr.xtb (renamed from chrome/app/policy/policy_templates_sr.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_sv.xtb (renamed from chrome/app/policy/policy_templates_sv.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_sw.xtb (renamed from chrome/app/policy/policy_templates_sw.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_ta.xtb (renamed from chrome/app/policy/policy_templates_ta.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_te.xtb (renamed from chrome/app/policy/policy_templates_te.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_th.xtb (renamed from chrome/app/policy/policy_templates_th.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_tr.xtb (renamed from chrome/app/policy/policy_templates_tr.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_uk.xtb (renamed from chrome/app/policy/policy_templates_uk.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_vi.xtb (renamed from chrome/app/policy/policy_templates_vi.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_zh-CN.xtb (renamed from chrome/app/policy/policy_templates_zh-CN.xtb) | 0 | ||||
-rw-r--r-- | components/policy/resources/policy_templates_zh-TW.xtb (renamed from chrome/app/policy/policy_templates_zh-TW.xtb) | 0 | ||||
-rwxr-xr-x | components/policy/tools/generate_policy_source.py (renamed from chrome/tools/build/generate_policy_source.py) | 0 | ||||
-rwxr-xr-x | components/policy/tools/make_policy_zip.py (renamed from chrome/tools/build/win/make_policy_zip.py) | 0 | ||||
-rwxr-xr-x | components/policy/tools/syntax_check_policy_template_json.py (renamed from chrome/app/policy/syntax_check_policy_template_json.py) | 0 | ||||
-rw-r--r-- | tools/gritsettings/resource_ids | 2 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 3 | ||||
-rw-r--r-- | tools/metrics/histograms/update_policies.py | 3 |
88 files changed, 452 insertions, 436 deletions
@@ -447,7 +447,7 @@ 'chrome/common/plugin|webkit/glue/webplugin|webkit/glue/plugins/', }, 'policy_templates': { - 'filepath': 'chrome/app/policy/policy_templates.json', + 'filepath': 'components/policy/resources/policy_templates.json', }, 'predictors': { 'filepath': 'predictors', diff --git a/build/all.gyp b/build/all.gyp index 75fd81d..c34de08 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -949,7 +949,7 @@ 'dependencies': [ '../chrome/chrome.gyp:crash_service', '../chrome/chrome.gyp:gcapi_dll', - '../chrome/chrome.gyp:policy_templates', + '../chrome/chrome.gyp:pack_policy_templates', '../courgette/courgette.gyp:courgette64', '../chrome/installer/mini_installer.gyp:mini_installer', '../courgette/courgette.gyp:courgette', diff --git a/chrome/app/policy/cloud_policy_codegen.gyp b/chrome/app/policy/cloud_policy_codegen.gyp deleted file mode 100644 index 963d7f5..0000000 --- a/chrome/app/policy/cloud_policy_codegen.gyp +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -{ - 'variables': { - 'chromium_code': 1, - 'policy_out_dir': '<(SHARED_INTERMEDIATE_DIR)/policy', - 'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out', - 'generate_policy_source_script_path': - '<(DEPTH)/chrome/tools/build/generate_policy_source.py', - 'policy_constant_header_path': - '<(policy_out_dir)/policy/policy_constants.h', - 'policy_constant_source_path': - '<(policy_out_dir)/policy/policy_constants.cc', - 'protobuf_decoder_path': - '<(policy_out_dir)/policy/cloud_policy_generated.cc', - # This is the "full" protobuf, which defines one protobuf message per - # policy. It is also the format currently used by the server. - 'chrome_settings_proto_path': - '<(policy_out_dir)/policy/chrome_settings.proto', - # This protobuf is equivalent to chrome_settings.proto but shares messages - # for policies of the same type, so that less classes have to be generated - # and compiled. - 'cloud_policy_proto_path': '<(policy_out_dir)/policy/cloud_policy.proto', - }, - 'targets': [ - { - 'target_name': 'cloud_policy_code_generate', - 'type': 'none', - 'actions': [ - { - 'inputs': [ - 'policy_templates.json', - '<(generate_policy_source_script_path)', - ], - 'outputs': [ - '<(policy_constant_header_path)', - '<(policy_constant_source_path)', - '<(protobuf_decoder_path)', - '<(chrome_settings_proto_path)', - '<(cloud_policy_proto_path)', - ], - 'action_name': 'generate_policy_source', - 'action': [ - 'python', - '<@(generate_policy_source_script_path)', - '--policy-constants-header=<(policy_constant_header_path)', - '--policy-constants-source=<(policy_constant_source_path)', - '--chrome-settings-protobuf=<(chrome_settings_proto_path)', - '--cloud-policy-protobuf=<(cloud_policy_proto_path)', - '--cloud-policy-decoder=<(protobuf_decoder_path)', - '<(OS)', - '<(chromeos)', - 'policy_templates.json', - ], - 'message': 'Generating policy source', - }, - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(policy_out_dir)', - '<(protoc_out_dir)', - ], - }, - }, - { - 'target_name': 'cloud_policy_proto_generated_compile', - 'type': 'static_library', - 'sources': [ - '<(cloud_policy_proto_path)', - ], - 'variables': { - 'proto_in_dir': '<(policy_out_dir)/policy', - 'proto_out_dir': 'policy/proto', - }, - 'dependencies': [ - 'cloud_policy_code_generate', - ], - 'includes': [ '../../../build/protoc.gypi' ], - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - 'msvs_disabled_warnings': [4267, ], - }, - { - # This target builds the "full" protobuf, used for tests only. - 'target_name': 'chrome_settings_proto_generated_compile', - 'type': 'static_library', - 'sources': [ - '<(chrome_settings_proto_path)', - ], - 'variables': { - 'proto_in_dir': '<(policy_out_dir)/policy', - 'proto_out_dir': 'policy/proto', - }, - 'dependencies': [ - 'cloud_policy_code_generate', - 'cloud_policy_proto_generated_compile', - ], - 'includes': [ '../../../build/protoc.gypi' ], - }, - { - 'target_name': 'policy', - 'type': 'static_library', - 'hard_dependency': 1, - 'direct_dependent_settings': { - 'include_dirs': [ - '<(policy_out_dir)', - '<(protoc_out_dir)', - ], - }, - 'sources': [ - '<(policy_constant_header_path)', - '<(policy_constant_source_path)', - '<(protobuf_decoder_path)', - ], - 'include_dirs': [ - '<(DEPTH)', - ], - 'dependencies': [ - 'cloud_policy_code_generate', - 'cloud_policy_proto_generated_compile', - '<(DEPTH)/base/base.gyp:base', - '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', - ], - }, - { - 'target_name': 'policy_test_support', - 'type': 'none', - 'hard_dependency': 1, - 'direct_dependent_settings': { - 'include_dirs': [ - '<(policy_out_dir)', - '<(protoc_out_dir)', - ], - }, - 'dependencies': [ - 'policy', - 'chrome_settings_proto_generated_compile', - ], - }, - ], - 'conditions': [ - ['OS=="win" and target_arch=="ia32"', { - 'targets': [ - { - 'target_name': 'policy_win64', - 'type': 'static_library', - 'hard_dependency': 1, - 'sources': [ - '<(policy_constant_header_path)', - '<(policy_constant_source_path)', - ], - 'include_dirs': [ - '<(DEPTH)', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(policy_out_dir)' - ], - }, - 'dependencies': [ - 'cloud_policy_code_generate', - ], - 'configurations': { - 'Common_Base': { - 'msvs_target_platform': 'x64', - }, - }, - }, - ], - }], - ], # 'conditions' -} diff --git a/chrome/app/policy/policy_templates.gypi b/chrome/app/policy/policy_templates.gypi deleted file mode 100644 index 467f65b..0000000 --- a/chrome/app/policy/policy_templates.gypi +++ /dev/null @@ -1,168 +0,0 @@ -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -{ - 'conditions': [ - ['OS=="win" or OS=="mac" or OS=="linux"', { - 'targets': [ - { - # policy_templates has different inputs and outputs, so it can't use - # the rules of chrome_strings - 'target_name': 'policy_templates', - 'type': 'none', - 'variables': { - 'grit_grd_file': 'policy_templates.grd', - 'grit_info_cmd': ['python', '<(DEPTH)/tools/grit/grit_info.py', - '<@(grit_defines)'], - }, - 'includes': [ '../../../build/grit_target.gypi' ], - 'actions': [ - { - 'action_name': 'policy_templates', - 'includes': [ '../../../build/grit_action.gypi' ], - }, - ], - 'conditions': [ - ['OS=="win"', { - 'variables': { - 'version_path': '<(grit_out_dir)/app/policy/VERSION', - 'template_files': [ - '<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(grit_grd_file))' - ], - }, - 'actions': [ - { - 'action_name': 'add_version', - 'inputs': ['../../VERSION'], - 'outputs': ['<(version_path)'], - 'action': ['cp', '<@(_inputs)', '<@(_outputs)'], - 'msvs_cygwin_shell': 1, - }, - { - # Add all the templates generated at the previous step into - # a zip archive. - 'action_name': 'pack_templates', - 'variables': { - 'zip_script': - 'tools/build/win/make_policy_zip.py' - }, - 'inputs': [ - '<(version_path)', - '<@(template_files)', - '<(zip_script)' - ], - 'outputs': [ - '<(PRODUCT_DIR)/policy_templates.zip' - ], - 'action': [ - 'python', - '<(zip_script)', - '--output', - '<@(_outputs)', - '--basedir', '<(grit_out_dir)/app/policy', - # The list of files in the destination zip is derived from - # the list of output nodes in the following grd file. - # This whole trickery is necessary because we cannot pass - # the entire list of file names as command line arguments, - # because they would exceed the length limit on Windows. - '--grd_input', - '<(grit_grd_file)', - '--grd_strip_path_prefix', - 'app/policy', - '--extra_input', - 'VERSION', - # Module to be used to process grd_input'. - '--grit_info', - '<(DEPTH)/tools/grit/grit_info.py', - '<@(grit_defines)', - ], - 'message': 'Packing generated templates into <(_outputs)', - 'msvs_cygwin_shell': 1, - } - ] - }], - ], # conditions - }, - ], # 'targets' - }], # OS=="win" or OS=="mac" or OS=="linux" - ['OS=="mac"', { - 'targets': [ - { - # This is the bundle of the manifest file of Chrome. - # It contains the manifest file and its string tables. - 'target_name': 'chrome_manifest_bundle', - 'type': 'loadable_module', - 'mac_bundle': 1, - 'product_extension': 'manifest', - 'product_name': '<(mac_bundle_id)', - 'variables': { - # This avoids stripping debugging symbols from the target, which - # would fail because there is no binary code here. - 'mac_strip': 0, - }, - 'dependencies': [ - # Provides app-Manifest.plist and its string tables: - 'policy_templates', - ], - 'actions': [ - { - 'action_name': 'Copy MCX manifest file to manifest bundle', - 'inputs': [ - '<(grit_out_dir)/app/policy/mac/app-Manifest.plist', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest', - ], - 'action': [ - # Use plutil -convert xml1 to put the plist into Apple's - # canonical format. As a side effect, this ensures that the - # plist is well-formed. - 'plutil', - '-convert', - 'xml1', - '<@(_inputs)', - '-o', - '<@(_outputs)', - ], - 'message': - 'Copying the MCX policy manifest file to the manifest bundle', - 'process_outputs_as_mac_bundle_resources': 1, - }, - { - 'action_name': - 'Copy Localizable.strings files to manifest bundle', - 'variables': { - 'input_path': '<(grit_out_dir)/app/policy/mac/strings', - # Directory to collect the Localizable.strings files before - # they are copied to the bundle. - 'output_path': '<(INTERMEDIATE_DIR)/app_manifest', - # The reason we are not enumerating all the locales is that - # the translations would eat up 3.5MB disk space in the - # application bundle: - 'available_locales': 'en', - }, - 'inputs': [ - # TODO: remove this helper when we have loops in GYP - '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))', - ], - 'outputs': [ - # TODO: remove this helper when we have loops in GYP - '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))', - ], - 'action': [ - 'cp', '-R', - '<(input_path)/', - '<(output_path)', - ], - 'message': - 'Copy the Localizable.strings files to the manifest bundle', - 'process_outputs_as_mac_bundle_resources': 1, - 'msvs_cygwin_shell': 1, - }, - ], - }, - ] - }] - ], # 'conditions' -} diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index 2c4bfa2..60baa1a 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -433,8 +433,8 @@ void VerifyControlledSettingIndicators(Browser* browser, TEST(PolicyPrefsTestCoverageTest, AllPoliciesHaveATestCase) { // Verifies that all known policies have a test case in the JSON file. // This test fails when a policy is added to - // chrome/app/policy/policy_templates.json but a test case is not added to - // chrome/test/data/policy/policy_test_cases.json. + // components/policy/resources/policy_templates.json but a test case is not + // added to chrome/test/data/policy/policy_test_cases.json. Schema chrome_schema = Schema::Wrap(GetChromeSchemaData()); ASSERT_TRUE(chrome_schema.valid()); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index deb868a..44c0c81 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -101,7 +101,6 @@ 'conditions': [ ['OS!="ios"', { 'includes': [ - 'app/policy/policy_templates.gypi', 'chrome_browser_extensions.gypi', 'chrome_dll.gypi', 'chrome_exe.gypi', @@ -109,6 +108,7 @@ 'chrome_renderer.gypi', 'chrome_tests.gypi', 'chrome_tests_unit.gypi', + 'policy_templates.gypi', '../apps/apps.gypi', ], 'targets': [ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 5b1ea14..bdda04b 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2782,8 +2782,8 @@ 'browser/policy/profile_policy_connector_stub.cc', ], 'dependencies': [ - 'app/policy/cloud_policy_codegen.gyp:policy', '../components/components.gyp:cloud_policy_proto', + '../components/components.gyp:policy', ], 'conditions': [ ['OS!="android"', { diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index 345f0f6..e9e6270 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -23,7 +23,6 @@ 'dependencies': [ # TODO(tbarzic): Cleanup this list. 'attestation_proto', - 'app/policy/cloud_policy_codegen.gyp:policy', 'browser/performance_monitor/performance_monitor.gyp:performance_monitor', 'browser_extensions', 'cert_logger_proto', @@ -52,6 +51,7 @@ '../chromeos/ime/input_method.gyp:gencode', '../components/components.gyp:cloud_policy_proto', '../components/components.gyp:onc_component', + '../components/components.gyp:policy', # This depends directly on the variations target, rather than just # transitively via the common target because the proto sources need to # be generated before code in this target can start building. diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 769928a..9fab561 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -1050,7 +1050,7 @@ }], ['configuration_policy==1', { 'dependencies': [ - 'app/policy/cloud_policy_codegen.gyp:policy', + '../components/components.gyp:policy', ], }, { # configuration_policy==0 'sources!': [ diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index d37f8e0..bd101a1 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -2725,7 +2725,7 @@ }], ['configuration_policy==1', { 'dependencies': [ - 'app/policy/cloud_policy_codegen.gyp:policy', + '../components/components.gyp:policy', ], }, { # configuration_policy==0 'sources/': [ diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index d0a9c46..a8ee329 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -423,7 +423,6 @@ }], ['OS != "ios"', { 'dependencies': [ - '<(DEPTH)/chrome/app/policy/cloud_policy_codegen.gyp:policy', '<(DEPTH)/chrome/common/extensions/api/api.gyp:api', '<(DEPTH)/components/components.gyp:autofill_core_common', '<(DEPTH)/components/components.gyp:autofill_content_common', @@ -497,9 +496,6 @@ 'common/net/url_util.cc', 'common/spellcheck_common.cc', ], - 'dependencies!': [ - '<(DEPTH)/chrome/app/policy/cloud_policy_codegen.gyp:policy', - ], }], ['OS=="win"', { 'include_dirs': [ @@ -577,6 +573,11 @@ 'common/print_messages.h', ] }], + ['configuration_policy==1', { + 'dependencies': [ + '<(DEPTH)/components/components.gyp:policy', + ], + }], ], 'target_conditions': [ ['OS == "ios"', { diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index 84a22fd..9d8cc05 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -80,8 +80,8 @@ }, 'dependencies': [ '<@(chromium_browser_dependencies)', + '../components/components.gyp:policy', '../content/content.gyp:content_app_browser', - 'app/policy/cloud_policy_codegen.gyp:policy', ], 'conditions': [ ['use_aura==1', { @@ -289,7 +289,7 @@ 'dependencies': [ '../breakpad/breakpad.gyp:breakpad', '../components/components.gyp:breakpad_component', - 'app/policy/cloud_policy_codegen.gyp:policy', + '../components/components.gyp:policy', ], 'sources': [ 'app/chrome_breakpad_client.cc', diff --git a/chrome/chrome_dll_bundle.gypi b/chrome/chrome_dll_bundle.gypi index 1f825c8..dc721ff 100644 --- a/chrome/chrome_dll_bundle.gypi +++ b/chrome/chrome_dll_bundle.gypi @@ -241,7 +241,7 @@ ['mac_breakpad_compiled_in==1', { 'dependencies': [ '../breakpad/breakpad.gyp:breakpad', - 'app/policy/cloud_policy_codegen.gyp:policy', + '../components/components.gyp:policy', ], 'copies': [ { diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index 2e0d24b..abd63a3 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi @@ -253,10 +253,10 @@ 'CHROMIUM_SHORT_NAME': '<(branding)', }, 'dependencies': [ + '../components/components.gyp:chrome_manifest_bundle', 'helper_app', 'infoplist_strings_tool', 'interpose_dependency_shim', - 'chrome_manifest_bundle', # On Mac, make sure we've built chrome_dll, which contains all of # the library code with Chromium functionality. 'chrome_dll', @@ -476,8 +476,8 @@ '../breakpad/breakpad.gyp:breakpad_sender', '../chrome_elf/chrome_elf.gyp:chrome_elf', '../components/components.gyp:breakpad_component', + '../components/components.gyp:policy', '../sandbox/sandbox.gyp:sandbox', - 'app/policy/cloud_policy_codegen.gyp:policy', ], 'sources': [ 'app/chrome_breakpad_client.cc', @@ -584,7 +584,6 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome_version/nacl64_exe_version.rc', ], 'dependencies': [ - 'app/policy/cloud_policy_codegen.gyp:policy_win64', 'chrome_version_resources', 'installer_util_nacl_win64', '../base/base.gyp:base_i18n_nacl_win64', @@ -595,6 +594,7 @@ '../breakpad/breakpad.gyp:breakpad_sender_win64', '../components/components.gyp:breakpad_win64', '../chrome/common_constants.gyp:common_constants_win64', + '../components/components.gyp:policy_win64', '../components/nacl.gyp:nacl_win64', '../crypto/crypto.gyp:crypto_nacl_win64', '../ipc/ipc.gyp:ipc_win64', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 80ef82b..366ea13 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -337,12 +337,12 @@ }], ['configuration_policy==1', { 'dependencies': [ - 'app/policy/cloud_policy_codegen.gyp:policy_test_support', '../components/components.gyp:policy_component_test_support', + '../components/components.gyp:policy_test_support', ], 'export_dependent_settings': [ - 'app/policy/cloud_policy_codegen.gyp:policy_test_support', '../components/components.gyp:policy_component_test_support', + '../components/components.gyp:policy_test_support', ], }], ['safe_browsing!=1', { diff --git a/chrome/policy.gypi b/chrome/policy.gypi index b130c47..79cc543 100644 --- a/chrome/policy.gypi +++ b/chrome/policy.gypi @@ -10,7 +10,7 @@ 'dependencies': [ '../base/base.gyp:base', '../chrome/common_constants.gyp:common_constants', - '../chrome/app/policy/cloud_policy_codegen.gyp:policy', + '../components/components.gyp:policy', ], 'include_dirs': [ '..', diff --git a/chrome/policy_templates.gypi b/chrome/policy_templates.gypi new file mode 100644 index 0000000..adf33de --- /dev/null +++ b/chrome/policy_templates.gypi @@ -0,0 +1,90 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'pack_policy_templates', + 'type': 'none', + 'conditions': [ + ['OS=="win" or OS=="mac" or OS=="linux"', { + 'dependencies': [ + '../components/components.gyp:policy_templates', + ], + }], + ['OS=="win"', { + 'variables': { + 'version_path': '<(grit_out_dir)/app/policy/VERSION', + }, + 'actions': [ + { + 'action_name': 'add_version', + 'inputs': [ + 'VERSION', + ], + 'outputs': [ + '<(version_path)', + ], + 'action': [ + 'cp', + '<@(_inputs)', + '<@(_outputs)', + ], + 'msvs_cygwin_shell': 1, + }, + { + # Add all the templates generated at the previous step into + # a zip archive. + 'action_name': 'pack_templates', + 'variables': { + 'grit_grd_file': '../components/policy/resources/policy_templates.grd', + 'grit_info_cmd': [ + 'python', + '<(DEPTH)/tools/grit/grit_info.py', + '<@(grit_defines)', + ], + 'template_files': [ + '<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(grit_grd_file))', + ], + 'zip_script': '../components/policy/tools/make_policy_zip.py', + }, + 'inputs': [ + '<(version_path)', + '<@(template_files)', + '<(zip_script)', + ], + 'outputs': [ + '<(PRODUCT_DIR)/policy_templates.zip', + ], + 'action': [ + 'python', + '<(zip_script)', + '--output', + '<@(_outputs)', + '--basedir', '<(grit_out_dir)/app/policy', + # The list of files in the destination zip is derived from + # the list of output nodes in the following grd file. + # This whole trickery is necessary because we cannot pass + # the entire list of file names as command line arguments, + # because they would exceed the length limit on Windows. + '--grd_input', + '<(grit_grd_file)', + '--grd_strip_path_prefix', + 'app/policy', + '--extra_input', + 'VERSION', + # Module to be used to process grd_input'. + '--grit_info', + '<(DEPTH)/tools/grit/grit_info.py', + '<@(grit_defines)', + ], + 'message': 'Packing generated templates into <(_outputs)', + 'msvs_cygwin_shell': 1, + }, + ], + }], + ], + }, + ], +} diff --git a/chrome/tools/build/OWNERS b/chrome/tools/build/OWNERS index 4dbd51c..cef46694 100644 --- a/chrome/tools/build/OWNERS +++ b/chrome/tools/build/OWNERS @@ -1,7 +1,3 @@ # Primarily for */FILES.cfg kerz@chromium.org mmoss@chromium.org - -per-file generate_policy_source.py=joaodasilva@chromium.org -per-file generate_policy_source.py=mnissler@chromium.org -per-file generate_policy_source.py=pastarmovj@chromium.org diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp index cd7d278..e3e7c71 100644 --- a/chrome_frame/chrome_frame.gyp +++ b/chrome_frame/chrome_frame.gyp @@ -104,8 +104,8 @@ 'type': 'executable', 'dependencies': [ '../base/base.gyp:test_support_base', - '../chrome/app/policy/cloud_policy_codegen.gyp:policy', '../chrome/chrome.gyp:test_support_common', + '../components/components.gyp:policy', '../net/net.gyp:net', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', @@ -667,9 +667,9 @@ 'target_name': 'chrome_frame_ie', 'type': 'static_library', 'dependencies': [ - '../chrome/app/policy/cloud_policy_codegen.gyp:policy', '../chrome/chrome.gyp:common', '../chrome/chrome.gyp:utility', + '../components/components.gyp:policy', '../content/content.gyp:content_common', '../net/net.gyp:net', '../third_party/libxml/libxml.gyp:libxml', diff --git a/chrome_frame/chrome_frame_launcher.gyp b/chrome_frame/chrome_frame_launcher.gyp index bd41148..194b965 100644 --- a/chrome_frame/chrome_frame_launcher.gyp +++ b/chrome_frame/chrome_frame_launcher.gyp @@ -101,7 +101,7 @@ 'type': 'executable', 'dependencies': [ '../breakpad/breakpad.gyp:breakpad_handler', - '../chrome/app/policy/cloud_policy_codegen.gyp:policy', + '../components/components.gyp:policy', '../google_update/google_update.gyp:google_update', 'chrome_frame.gyp:chrome_frame_utils', 'chrome_frame_launcher_version_resources', diff --git a/components/components_tests.gyp b/components/components_tests.gyp index 69e44da..29055103 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp @@ -97,9 +97,6 @@ # Dependencies of json_schema 'components.gyp:json_schema', - # Dependencies of policy - 'components.gyp:policy_component', - # Dependencies of precache 'components.gyp:precache_core', @@ -203,10 +200,9 @@ }], ['configuration_policy==1', { 'dependencies': [ - # TODO(joaodasilva): remove this dependency. This is needed to - # get the include path for policy_constants.h. - '../chrome/app/policy/cloud_policy_codegen.gyp:policy_test_support', + 'components.gyp:policy_component', 'components.gyp:policy_component_test_support', + 'components.gyp:policy_test_support', ], 'sources': [ 'policy/core/common/async_policy_provider_unittest.cc', diff --git a/components/policy.gypi b/components/policy.gypi index 4e05b54..5d31487 100644 --- a/components/policy.gypi +++ b/components/policy.gypi @@ -3,6 +3,33 @@ # found in the LICENSE file. { + 'includes': [ + # Included to get 'mac_bundle_id' and other variables. + '../build/chrome_settings.gypi', + ], + 'variables': { + 'chromium_code': 1, + 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', + 'policy_out_dir': '<(SHARED_INTERMEDIATE_DIR)/policy', + 'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out', + 'generate_policy_source_script_path': + 'policy/tools/generate_policy_source.py', + 'policy_constant_header_path': + '<(policy_out_dir)/policy/policy_constants.h', + 'policy_constant_source_path': + '<(policy_out_dir)/policy/policy_constants.cc', + 'protobuf_decoder_path': + '<(policy_out_dir)/policy/cloud_policy_generated.cc', + # This is the "full" protobuf, which defines one protobuf message per + # policy. It is also the format currently used by the server. + 'chrome_settings_proto_path': + '<(policy_out_dir)/policy/chrome_settings.proto', + # This protobuf is equivalent to chrome_settings.proto but shares messages + # for policies of the same type, so that less classes have to be generated + # and compiled. + 'cloud_policy_proto_path': + '<(policy_out_dir)/policy/cloud_policy.proto', + }, 'targets': [ { 'target_name': 'policy_component', @@ -21,14 +48,13 @@ 'dependencies': [ '../base/base.gyp:base_prefs', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - # TODO(joaodasilva): remove this dependency on the user policy protobuf. - '../chrome/app/policy/cloud_policy_codegen.gyp:policy', '../google_apis/google_apis.gyp:google_apis', '../ui/ui.gyp:ui', '../url/url.gyp:url_lib', 'component_strings.gyp:component_strings', 'cloud_policy_proto', 'json_schema', + 'policy', ], 'sources': [ 'policy/core/browser/cloud/message_util.cc', @@ -205,37 +231,159 @@ }], ], }, - { - 'target_name': 'cloud_policy_proto', - 'type': 'static_library', - 'sources': [ - 'policy/proto/chrome_extension_policy.proto', - 'policy/proto/device_management_backend.proto', - 'policy/proto/device_management_local.proto', - ], - 'variables': { - 'proto_in_dir': 'policy/proto', - 'proto_out_dir': 'policy/proto', - }, - 'includes': [ '../build/protoc.gypi' ], - 'conditions': [ - ['OS=="android"', { - 'sources!': [ - 'policy/proto/chrome_extension_policy.proto', - ], - }], - ['chromeos==0', { - 'sources!': [ - 'policy/proto/device_management_local.proto', - ], - }], - ], - }, ], 'conditions': [ ['configuration_policy==1', { 'targets': [ { + 'target_name': 'cloud_policy_code_generate', + 'type': 'none', + 'actions': [ + { + 'inputs': [ + 'policy/resources/policy_templates.json', + '<(generate_policy_source_script_path)', + ], + 'outputs': [ + '<(policy_constant_header_path)', + '<(policy_constant_source_path)', + '<(protobuf_decoder_path)', + '<(chrome_settings_proto_path)', + '<(cloud_policy_proto_path)', + ], + 'action_name': 'generate_policy_source', + 'action': [ + 'python', + '<@(generate_policy_source_script_path)', + '--policy-constants-header=<(policy_constant_header_path)', + '--policy-constants-source=<(policy_constant_source_path)', + '--chrome-settings-protobuf=<(chrome_settings_proto_path)', + '--cloud-policy-protobuf=<(cloud_policy_proto_path)', + '--cloud-policy-decoder=<(protobuf_decoder_path)', + '<(OS)', + '<(chromeos)', + 'policy/resources/policy_templates.json', + ], + 'message': 'Generating policy source', + }, + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '<(policy_out_dir)', + '<(protoc_out_dir)', + ], + }, + }, + { + 'target_name': 'cloud_policy_proto_generated_compile', + 'type': 'static_library', + 'sources': [ + '<(cloud_policy_proto_path)', + ], + 'variables': { + 'proto_in_dir': '<(policy_out_dir)/policy', + 'proto_out_dir': 'policy/proto', + }, + 'dependencies': [ + 'cloud_policy_code_generate', + ], + 'includes': [ + '../build/protoc.gypi', + ], + # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. + 'msvs_disabled_warnings': [4267, ], + }, + { + # This target builds the "full" protobuf, used for tests only. + 'target_name': 'chrome_settings_proto_generated_compile', + 'type': 'static_library', + 'sources': [ + '<(chrome_settings_proto_path)', + ], + 'variables': { + 'proto_in_dir': '<(policy_out_dir)/policy', + 'proto_out_dir': 'policy/proto', + }, + 'dependencies': [ + 'cloud_policy_code_generate', + 'cloud_policy_proto_generated_compile', + ], + 'includes': [ + '../build/protoc.gypi', + ], + }, + { + 'target_name': 'policy', + 'type': 'static_library', + 'hard_dependency': 1, + 'direct_dependent_settings': { + 'include_dirs': [ + '<(policy_out_dir)', + '<(protoc_out_dir)', + ], + }, + 'sources': [ + '<(policy_constant_header_path)', + '<(policy_constant_source_path)', + '<(protobuf_decoder_path)', + ], + 'include_dirs': [ + '<(DEPTH)', + ], + 'dependencies': [ + 'cloud_policy_code_generate', + 'cloud_policy_proto_generated_compile', + '<(DEPTH)/base/base.gyp:base', + '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', + ], + 'defines': [ + 'POLICY_COMPONENT_IMPLEMENTATION', + ], + }, + { + 'target_name': 'cloud_policy_proto', + 'type': 'static_library', + 'sources': [ + 'policy/proto/chrome_extension_policy.proto', + 'policy/proto/device_management_backend.proto', + 'policy/proto/device_management_local.proto', + ], + 'variables': { + 'proto_in_dir': 'policy/proto', + 'proto_out_dir': 'policy/proto', + }, + 'includes': [ + '../build/protoc.gypi', + ], + 'conditions': [ + ['OS=="android"', { + 'sources!': [ + 'policy/proto/chrome_extension_policy.proto', + ], + }], + ['chromeos==0', { + 'sources!': [ + 'policy/proto/device_management_local.proto', + ], + }], + ], + }, + { + 'target_name': 'policy_test_support', + 'type': 'none', + 'hard_dependency': 1, + 'direct_dependent_settings': { + 'include_dirs': [ + '<(policy_out_dir)', + '<(protoc_out_dir)', + ], + }, + 'dependencies': [ + 'chrome_settings_proto_generated_compile', + 'policy', + ], + }, + { 'target_name': 'policy_component_test_support', 'type': 'static_library', # This must be undefined so that POLICY_EXPORT works correctly in @@ -244,10 +392,9 @@ 'POLICY_COMPONENT_IMPLEMENTATION', ], 'dependencies': [ - # TODO(joaodasilva): remove this dependency. - '../chrome/app/policy/cloud_policy_codegen.gyp:policy_test_support', 'cloud_policy_proto', 'policy_component', + 'policy_test_support', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', ], @@ -289,5 +436,141 @@ }, ], }], + ['OS=="win" and target_arch=="ia32" and configuration_policy==1', { + 'targets': [ + { + 'target_name': 'policy_win64', + 'type': 'static_library', + 'hard_dependency': 1, + 'sources': [ + '<(policy_constant_header_path)', + '<(policy_constant_source_path)', + ], + 'include_dirs': [ + '<(DEPTH)', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '<(policy_out_dir)' + ], + }, + 'dependencies': [ + 'cloud_policy_code_generate', + ], + 'configurations': { + 'Common_Base': { + 'msvs_target_platform': 'x64', + }, + }, + }, + ], + }], + ['OS=="win" or OS=="mac" or OS=="linux"', { + 'targets': [ + { + # policy_templates has different inputs and outputs, so it can't use + # the rules of chrome_strings + 'target_name': 'policy_templates', + 'type': 'none', + 'variables': { + 'grit_grd_file': 'policy/resources/policy_templates.grd', + 'grit_info_cmd': [ + 'python', + '<(DEPTH)/tools/grit/grit_info.py', + '<@(grit_defines)', + ], + }, + 'includes': [ + '../build/grit_target.gypi', + ], + 'actions': [ + { + 'action_name': 'policy_templates', + 'includes': [ + '../build/grit_action.gypi', + ], + }, + ], + }, + ], + }], + ['OS=="mac"', { + 'targets': [ + { + # This is the bundle of the manifest file of Chrome. + # It contains the manifest file and its string tables. + 'target_name': 'chrome_manifest_bundle', + 'type': 'loadable_module', + 'mac_bundle': 1, + 'product_extension': 'manifest', + 'product_name': '<(mac_bundle_id)', + 'variables': { + # This avoids stripping debugging symbols from the target, which + # would fail because there is no binary code here. + 'mac_strip': 0, + }, + 'dependencies': [ + # Provides app-Manifest.plist and its string tables: + 'policy_templates', + ], + 'actions': [ + { + 'action_name': 'Copy MCX manifest file to manifest bundle', + 'inputs': [ + '<(grit_out_dir)/app/policy/mac/app-Manifest.plist', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest', + ], + 'action': [ + # Use plutil -convert xml1 to put the plist into Apple's + # canonical format. As a side effect, this ensures that the + # plist is well-formed. + 'plutil', + '-convert', + 'xml1', + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + 'message': + 'Copying the MCX policy manifest file to the manifest bundle', + 'process_outputs_as_mac_bundle_resources': 1, + }, + { + 'action_name': + 'Copy Localizable.strings files to manifest bundle', + 'variables': { + 'input_path': '<(grit_out_dir)/app/policy/mac/strings', + # Directory to collect the Localizable.strings files before + # they are copied to the bundle. + 'output_path': '<(INTERMEDIATE_DIR)/app_manifest', + # The reason we are not enumerating all the locales is that + # the translations would eat up 3.5MB disk space in the + # application bundle: + 'available_locales': 'en', + }, + 'inputs': [ + # TODO: remove this helper when we have loops in GYP + '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))', + ], + 'outputs': [ + # TODO: remove this helper when we have loops in GYP + '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))', + ], + 'action': [ + 'cp', '-R', + '<(input_path)/', + '<(output_path)', + ], + 'message': + 'Copy the Localizable.strings files to the manifest bundle', + 'process_outputs_as_mac_bundle_resources': 1, + 'msvs_cygwin_shell': 1, + }, + ], + }, + ], + }], ], } diff --git a/components/policy/core/DEPS b/components/policy/core/DEPS index 486abcf..7b46c50 100644 --- a/components/policy/core/DEPS +++ b/components/policy/core/DEPS @@ -4,10 +4,10 @@ include_rules = [ "+google_apis", "+net", - # These are generated from components/policy/proto. + # These are generated from components/policy/proto and + # components/policy/resources/policy_templates.json. + "+policy/policy_constants.h", "+policy/proto/chrome_extension_policy.pb.h", - "+policy/proto/device_management_backend.pb.h", - - # TODO(joaodasilva): move the generation of this protobuf into the component. "+policy/proto/cloud_policy.pb.h", + "+policy/proto/device_management_backend.pb.h", ] diff --git a/components/policy/core/common/cloud/DEPS b/components/policy/core/common/cloud/DEPS deleted file mode 100644 index 458b8b5..0000000 --- a/components/policy/core/common/cloud/DEPS +++ /dev/null @@ -1,7 +0,0 @@ -# TODO(joaodasilva): remove this DEPS exception after moving chrome/app/policy -# into the component. -specific_include_rules = { - 'user_cloud_policy_store_unittest\.cc': [ - "+policy/policy_constants.h", - ], -} diff --git a/components/policy/core/common/policy_map.cc b/components/policy/core/common/policy_map.cc index 40cf733..ffcdf43 100644 --- a/components/policy/core/common/policy_map.cc +++ b/components/policy/core/common/policy_map.cc @@ -11,6 +11,12 @@ namespace policy { +PolicyMap::Entry::Entry() + : level(POLICY_LEVEL_RECOMMENDED), + scope(POLICY_SCOPE_USER), + value(NULL), + external_data_fetcher(NULL) {} + void PolicyMap::Entry::DeleteOwnedMembers() { delete value; value = NULL; diff --git a/components/policy/core/common/policy_map.h b/components/policy/core/common/policy_map.h index 079ce52..7d0d06b 100644 --- a/components/policy/core/common/policy_map.h +++ b/components/policy/core/common/policy_map.h @@ -28,11 +28,7 @@ class POLICY_EXPORT PolicyMap { base::Value* value; ExternalDataFetcher* external_data_fetcher; - Entry() - : level(POLICY_LEVEL_RECOMMENDED), - scope(POLICY_SCOPE_USER), - value(NULL), - external_data_fetcher(NULL) {} + Entry(); // Deletes all members owned by |this|. void DeleteOwnedMembers(); diff --git a/chrome/app/policy/OWNERS b/components/policy/resources/OWNERS index 849d4b0..ba967b1 100644 --- a/chrome/app/policy/OWNERS +++ b/components/policy/resources/OWNERS @@ -1,11 +1,3 @@ -pastarmovj@chromium.org -mnissler@chromium.org -joaodasilva@chromium.org -bartfab@chromium.org -atwilson@chromium.org -pneubeck@chromium.org -dconnelly@chromium.org - # Updating policy_templates.json can have drastic effects for systems depending # on policy definitions (for example, Google's cloud management tools for # Chrome and Chrome OS). Thus, special attention to forward/backward diff --git a/chrome/app/policy/PRESUBMIT.py b/components/policy/resources/PRESUBMIT.py index 91f24c4..3870875 100644 --- a/chrome/app/policy/PRESUBMIT.py +++ b/components/policy/resources/PRESUBMIT.py @@ -26,13 +26,15 @@ def _GetPolicyTemplates(template_path): return list(itertools.chain(policies, subpolicies)) def _CheckPolicyTemplatesSyntax(input_api, output_api): - filepath = input_api.os_path.join(input_api.PresubmitLocalPath(), - 'policy_templates.json') + local_path = input_api.PresubmitLocalPath() + filepath = input_api.os_path.join(local_path, 'policy_templates.json') if any(f.AbsoluteLocalPath() == filepath for f in input_api.AffectedFiles()): old_sys_path = sys.path try: - sys.path = [input_api.PresubmitLocalPath()] + sys.path + tools_path = input_api.os_path.normpath( + input_api.os_path.join(local_path, input_api.os_path.pardir, 'tools')) + sys.path = [ tools_path ] + sys.path # Optimization: only load this when it's needed. import syntax_check_policy_template_json checker = syntax_check_policy_template_json.PolicyTemplateChecker() diff --git a/chrome/app/policy/policy_templates.grd b/components/policy/resources/policy_templates.grd index 23590f7..23590f7 100644 --- a/chrome/app/policy/policy_templates.grd +++ b/components/policy/resources/policy_templates.grd diff --git a/chrome/app/policy/policy_templates.json b/components/policy/resources/policy_templates.json index ffb91d5..ffb91d5 100644 --- a/chrome/app/policy/policy_templates.json +++ b/components/policy/resources/policy_templates.json diff --git a/chrome/app/policy/policy_templates_am.xtb b/components/policy/resources/policy_templates_am.xtb index 3b4d8aa..3b4d8aa 100644 --- a/chrome/app/policy/policy_templates_am.xtb +++ b/components/policy/resources/policy_templates_am.xtb diff --git a/chrome/app/policy/policy_templates_ar.xtb b/components/policy/resources/policy_templates_ar.xtb index 410435d..410435d 100644 --- a/chrome/app/policy/policy_templates_ar.xtb +++ b/components/policy/resources/policy_templates_ar.xtb diff --git a/chrome/app/policy/policy_templates_bg.xtb b/components/policy/resources/policy_templates_bg.xtb index adc8865..adc8865 100644 --- a/chrome/app/policy/policy_templates_bg.xtb +++ b/components/policy/resources/policy_templates_bg.xtb diff --git a/chrome/app/policy/policy_templates_bn.xtb b/components/policy/resources/policy_templates_bn.xtb index fa8f4a1..fa8f4a1 100644 --- a/chrome/app/policy/policy_templates_bn.xtb +++ b/components/policy/resources/policy_templates_bn.xtb diff --git a/chrome/app/policy/policy_templates_ca.xtb b/components/policy/resources/policy_templates_ca.xtb index 73d5518..73d5518 100644 --- a/chrome/app/policy/policy_templates_ca.xtb +++ b/components/policy/resources/policy_templates_ca.xtb diff --git a/chrome/app/policy/policy_templates_cs.xtb b/components/policy/resources/policy_templates_cs.xtb index 362b646..362b646 100644 --- a/chrome/app/policy/policy_templates_cs.xtb +++ b/components/policy/resources/policy_templates_cs.xtb diff --git a/chrome/app/policy/policy_templates_da.xtb b/components/policy/resources/policy_templates_da.xtb index 8b5d891..8b5d891 100644 --- a/chrome/app/policy/policy_templates_da.xtb +++ b/components/policy/resources/policy_templates_da.xtb diff --git a/chrome/app/policy/policy_templates_de.xtb b/components/policy/resources/policy_templates_de.xtb index 02471c8..02471c8 100644 --- a/chrome/app/policy/policy_templates_de.xtb +++ b/components/policy/resources/policy_templates_de.xtb diff --git a/chrome/app/policy/policy_templates_el.xtb b/components/policy/resources/policy_templates_el.xtb index 5a78611..5a78611 100644 --- a/chrome/app/policy/policy_templates_el.xtb +++ b/components/policy/resources/policy_templates_el.xtb diff --git a/chrome/app/policy/policy_templates_en-GB.xtb b/components/policy/resources/policy_templates_en-GB.xtb index 87c1dd2..87c1dd2 100644 --- a/chrome/app/policy/policy_templates_en-GB.xtb +++ b/components/policy/resources/policy_templates_en-GB.xtb diff --git a/chrome/app/policy/policy_templates_es-419.xtb b/components/policy/resources/policy_templates_es-419.xtb index 644da48..644da48 100644 --- a/chrome/app/policy/policy_templates_es-419.xtb +++ b/components/policy/resources/policy_templates_es-419.xtb diff --git a/chrome/app/policy/policy_templates_es.xtb b/components/policy/resources/policy_templates_es.xtb index 6c559bf..6c559bf 100644 --- a/chrome/app/policy/policy_templates_es.xtb +++ b/components/policy/resources/policy_templates_es.xtb diff --git a/chrome/app/policy/policy_templates_et.xtb b/components/policy/resources/policy_templates_et.xtb index 0f66c63..0f66c63 100644 --- a/chrome/app/policy/policy_templates_et.xtb +++ b/components/policy/resources/policy_templates_et.xtb diff --git a/chrome/app/policy/policy_templates_fa.xtb b/components/policy/resources/policy_templates_fa.xtb index 93e6aa4..93e6aa4 100644 --- a/chrome/app/policy/policy_templates_fa.xtb +++ b/components/policy/resources/policy_templates_fa.xtb diff --git a/chrome/app/policy/policy_templates_fi.xtb b/components/policy/resources/policy_templates_fi.xtb index 41d67ea..41d67ea 100644 --- a/chrome/app/policy/policy_templates_fi.xtb +++ b/components/policy/resources/policy_templates_fi.xtb diff --git a/chrome/app/policy/policy_templates_fil.xtb b/components/policy/resources/policy_templates_fil.xtb index c11cc8a..c11cc8a 100644 --- a/chrome/app/policy/policy_templates_fil.xtb +++ b/components/policy/resources/policy_templates_fil.xtb diff --git a/chrome/app/policy/policy_templates_fr.xtb b/components/policy/resources/policy_templates_fr.xtb index cf2dc72..cf2dc72 100644 --- a/chrome/app/policy/policy_templates_fr.xtb +++ b/components/policy/resources/policy_templates_fr.xtb diff --git a/chrome/app/policy/policy_templates_gu.xtb b/components/policy/resources/policy_templates_gu.xtb index d6de721..d6de721 100644 --- a/chrome/app/policy/policy_templates_gu.xtb +++ b/components/policy/resources/policy_templates_gu.xtb diff --git a/chrome/app/policy/policy_templates_hi.xtb b/components/policy/resources/policy_templates_hi.xtb index 710cc98..710cc98 100644 --- a/chrome/app/policy/policy_templates_hi.xtb +++ b/components/policy/resources/policy_templates_hi.xtb diff --git a/chrome/app/policy/policy_templates_hr.xtb b/components/policy/resources/policy_templates_hr.xtb index a44dfe2..a44dfe2 100644 --- a/chrome/app/policy/policy_templates_hr.xtb +++ b/components/policy/resources/policy_templates_hr.xtb diff --git a/chrome/app/policy/policy_templates_hu.xtb b/components/policy/resources/policy_templates_hu.xtb index e295ddf..e295ddf 100644 --- a/chrome/app/policy/policy_templates_hu.xtb +++ b/components/policy/resources/policy_templates_hu.xtb diff --git a/chrome/app/policy/policy_templates_id.xtb b/components/policy/resources/policy_templates_id.xtb index 5dc049c..5dc049c 100644 --- a/chrome/app/policy/policy_templates_id.xtb +++ b/components/policy/resources/policy_templates_id.xtb diff --git a/chrome/app/policy/policy_templates_it.xtb b/components/policy/resources/policy_templates_it.xtb index 3c8d68b..3c8d68b 100644 --- a/chrome/app/policy/policy_templates_it.xtb +++ b/components/policy/resources/policy_templates_it.xtb diff --git a/chrome/app/policy/policy_templates_iw.xtb b/components/policy/resources/policy_templates_iw.xtb index db0e89a..db0e89a 100644 --- a/chrome/app/policy/policy_templates_iw.xtb +++ b/components/policy/resources/policy_templates_iw.xtb diff --git a/chrome/app/policy/policy_templates_ja.xtb b/components/policy/resources/policy_templates_ja.xtb index 807d356..807d356 100644 --- a/chrome/app/policy/policy_templates_ja.xtb +++ b/components/policy/resources/policy_templates_ja.xtb diff --git a/chrome/app/policy/policy_templates_kn.xtb b/components/policy/resources/policy_templates_kn.xtb index 92ebdaa..92ebdaa 100644 --- a/chrome/app/policy/policy_templates_kn.xtb +++ b/components/policy/resources/policy_templates_kn.xtb diff --git a/chrome/app/policy/policy_templates_ko.xtb b/components/policy/resources/policy_templates_ko.xtb index a89d213..a89d213 100644 --- a/chrome/app/policy/policy_templates_ko.xtb +++ b/components/policy/resources/policy_templates_ko.xtb diff --git a/chrome/app/policy/policy_templates_lt.xtb b/components/policy/resources/policy_templates_lt.xtb index f11ba61..f11ba61 100644 --- a/chrome/app/policy/policy_templates_lt.xtb +++ b/components/policy/resources/policy_templates_lt.xtb diff --git a/chrome/app/policy/policy_templates_lv.xtb b/components/policy/resources/policy_templates_lv.xtb index 131ed6f..131ed6f 100644 --- a/chrome/app/policy/policy_templates_lv.xtb +++ b/components/policy/resources/policy_templates_lv.xtb diff --git a/chrome/app/policy/policy_templates_ml.xtb b/components/policy/resources/policy_templates_ml.xtb index 8ffb824..8ffb824 100644 --- a/chrome/app/policy/policy_templates_ml.xtb +++ b/components/policy/resources/policy_templates_ml.xtb diff --git a/chrome/app/policy/policy_templates_mr.xtb b/components/policy/resources/policy_templates_mr.xtb index 5c1c3f8..5c1c3f8 100644 --- a/chrome/app/policy/policy_templates_mr.xtb +++ b/components/policy/resources/policy_templates_mr.xtb diff --git a/chrome/app/policy/policy_templates_ms.xtb b/components/policy/resources/policy_templates_ms.xtb index 5e3ef42..5e3ef42 100644 --- a/chrome/app/policy/policy_templates_ms.xtb +++ b/components/policy/resources/policy_templates_ms.xtb diff --git a/chrome/app/policy/policy_templates_nl.xtb b/components/policy/resources/policy_templates_nl.xtb index 44dd138..44dd138 100644 --- a/chrome/app/policy/policy_templates_nl.xtb +++ b/components/policy/resources/policy_templates_nl.xtb diff --git a/chrome/app/policy/policy_templates_no.xtb b/components/policy/resources/policy_templates_no.xtb index 416fdca..416fdca 100644 --- a/chrome/app/policy/policy_templates_no.xtb +++ b/components/policy/resources/policy_templates_no.xtb diff --git a/chrome/app/policy/policy_templates_pl.xtb b/components/policy/resources/policy_templates_pl.xtb index bd5a6b6..bd5a6b6 100644 --- a/chrome/app/policy/policy_templates_pl.xtb +++ b/components/policy/resources/policy_templates_pl.xtb diff --git a/chrome/app/policy/policy_templates_pt-BR.xtb b/components/policy/resources/policy_templates_pt-BR.xtb index 94be278..94be278 100644 --- a/chrome/app/policy/policy_templates_pt-BR.xtb +++ b/components/policy/resources/policy_templates_pt-BR.xtb diff --git a/chrome/app/policy/policy_templates_pt-PT.xtb b/components/policy/resources/policy_templates_pt-PT.xtb index 3d29eef..3d29eef 100644 --- a/chrome/app/policy/policy_templates_pt-PT.xtb +++ b/components/policy/resources/policy_templates_pt-PT.xtb diff --git a/chrome/app/policy/policy_templates_ro.xtb b/components/policy/resources/policy_templates_ro.xtb index 443727e..443727e 100644 --- a/chrome/app/policy/policy_templates_ro.xtb +++ b/components/policy/resources/policy_templates_ro.xtb diff --git a/chrome/app/policy/policy_templates_ru.xtb b/components/policy/resources/policy_templates_ru.xtb index 7f41f55..7f41f55 100644 --- a/chrome/app/policy/policy_templates_ru.xtb +++ b/components/policy/resources/policy_templates_ru.xtb diff --git a/chrome/app/policy/policy_templates_sk.xtb b/components/policy/resources/policy_templates_sk.xtb index b405f85..b405f85 100644 --- a/chrome/app/policy/policy_templates_sk.xtb +++ b/components/policy/resources/policy_templates_sk.xtb diff --git a/chrome/app/policy/policy_templates_sl.xtb b/components/policy/resources/policy_templates_sl.xtb index a5682c5..a5682c5 100644 --- a/chrome/app/policy/policy_templates_sl.xtb +++ b/components/policy/resources/policy_templates_sl.xtb diff --git a/chrome/app/policy/policy_templates_sr.xtb b/components/policy/resources/policy_templates_sr.xtb index ba268ae..ba268ae 100644 --- a/chrome/app/policy/policy_templates_sr.xtb +++ b/components/policy/resources/policy_templates_sr.xtb diff --git a/chrome/app/policy/policy_templates_sv.xtb b/components/policy/resources/policy_templates_sv.xtb index de70a11..de70a11 100644 --- a/chrome/app/policy/policy_templates_sv.xtb +++ b/components/policy/resources/policy_templates_sv.xtb diff --git a/chrome/app/policy/policy_templates_sw.xtb b/components/policy/resources/policy_templates_sw.xtb index 4abe0cb..4abe0cb 100644 --- a/chrome/app/policy/policy_templates_sw.xtb +++ b/components/policy/resources/policy_templates_sw.xtb diff --git a/chrome/app/policy/policy_templates_ta.xtb b/components/policy/resources/policy_templates_ta.xtb index 15615c3..15615c3 100644 --- a/chrome/app/policy/policy_templates_ta.xtb +++ b/components/policy/resources/policy_templates_ta.xtb diff --git a/chrome/app/policy/policy_templates_te.xtb b/components/policy/resources/policy_templates_te.xtb index fe0c5a7..fe0c5a7 100644 --- a/chrome/app/policy/policy_templates_te.xtb +++ b/components/policy/resources/policy_templates_te.xtb diff --git a/chrome/app/policy/policy_templates_th.xtb b/components/policy/resources/policy_templates_th.xtb index d3b53d07..d3b53d07 100644 --- a/chrome/app/policy/policy_templates_th.xtb +++ b/components/policy/resources/policy_templates_th.xtb diff --git a/chrome/app/policy/policy_templates_tr.xtb b/components/policy/resources/policy_templates_tr.xtb index 0b0f7d1..0b0f7d1 100644 --- a/chrome/app/policy/policy_templates_tr.xtb +++ b/components/policy/resources/policy_templates_tr.xtb diff --git a/chrome/app/policy/policy_templates_uk.xtb b/components/policy/resources/policy_templates_uk.xtb index c7af9e0..c7af9e0 100644 --- a/chrome/app/policy/policy_templates_uk.xtb +++ b/components/policy/resources/policy_templates_uk.xtb diff --git a/chrome/app/policy/policy_templates_vi.xtb b/components/policy/resources/policy_templates_vi.xtb index 5c8f1ca..5c8f1ca 100644 --- a/chrome/app/policy/policy_templates_vi.xtb +++ b/components/policy/resources/policy_templates_vi.xtb diff --git a/chrome/app/policy/policy_templates_zh-CN.xtb b/components/policy/resources/policy_templates_zh-CN.xtb index 2cf1c2d..2cf1c2d 100644 --- a/chrome/app/policy/policy_templates_zh-CN.xtb +++ b/components/policy/resources/policy_templates_zh-CN.xtb diff --git a/chrome/app/policy/policy_templates_zh-TW.xtb b/components/policy/resources/policy_templates_zh-TW.xtb index 1a6389d..1a6389d 100644 --- a/chrome/app/policy/policy_templates_zh-TW.xtb +++ b/components/policy/resources/policy_templates_zh-TW.xtb diff --git a/chrome/tools/build/generate_policy_source.py b/components/policy/tools/generate_policy_source.py index 315650d..315650d 100755 --- a/chrome/tools/build/generate_policy_source.py +++ b/components/policy/tools/generate_policy_source.py diff --git a/chrome/tools/build/win/make_policy_zip.py b/components/policy/tools/make_policy_zip.py index 88fdd26..88fdd26 100755 --- a/chrome/tools/build/win/make_policy_zip.py +++ b/components/policy/tools/make_policy_zip.py diff --git a/chrome/app/policy/syntax_check_policy_template_json.py b/components/policy/tools/syntax_check_policy_template_json.py index f51e3e3..f51e3e3 100755 --- a/chrome/app/policy/syntax_check_policy_template_json.py +++ b/components/policy/tools/syntax_check_policy_template_json.py diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids index f520ed9..80ba1d0 100644 --- a/tools/gritsettings/resource_ids +++ b/tools/gritsettings/resource_ids @@ -125,7 +125,7 @@ "structures": [19500], }, - "chrome/app/policy/policy_templates.grd": { + "components/policy/resources/policy_templates.grd": { "structures": [20500], "messages": [20510], }, diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index b0cec02..d81bc01 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -23076,7 +23076,8 @@ other types of suffix sets. </enum> <enum name="EnterprisePolicies" type="int"> -<!-- Generated from ../../../chrome/app/policy/policy_templates.json --> +<!-- Generated from + ../../../components/policy/resources/policy_templates.json --> <int value="1" label="Configure the home page URL"/> <int value="2" label="Use New Tab Page as homepage"/> diff --git a/tools/metrics/histograms/update_policies.py b/tools/metrics/histograms/update_policies.py index dd0447f..5cad317 100644 --- a/tools/metrics/histograms/update_policies.py +++ b/tools/metrics/histograms/update_policies.py @@ -19,7 +19,8 @@ from diffutil import PromptUserToAcceptDiff from pretty_print import PrettyPrintNode HISTOGRAMS_PATH = 'histograms.xml' -POLICY_TEMPLATES_PATH = '../../../chrome/app/policy/policy_templates.json' +POLICY_TEMPLATES_PATH = + '../../../components/policy/resources/policy_templates.json' ENUM_NAME = 'EnterprisePolicies' class UserError(Exception): |