diff options
author | danno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-27 12:31:34 +0000 |
---|---|---|
committer | danno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-27 12:31:34 +0000 |
commit | 934c6e5446780bf26b8ee9fd171aa69db4b0f253 (patch) | |
tree | 0b31702844a9ffb41fb84f729d29232c6d85eba1 | |
parent | 150f43b345029c037176b4d23c2c32aacd8b6dfc (diff) | |
download | chromium_src-934c6e5446780bf26b8ee9fd171aa69db4b0f253.zip chromium_src-934c6e5446780bf26b8ee9fd171aa69db4b0f253.tar.gz chromium_src-934c6e5446780bf26b8ee9fd171aa69db4b0f253.tar.bz2 |
Revert 72784 - Policy: generate boilerplate policy type and constant code.
This is the first step to being able to re-constitute policy from a non-generic protobuf in a policy request in a fully automated way (i.e. the code for the process can be generated). The non-generic protobuf is required for automatic merging of policy on the server-side.
BUG=68309
TEST=existing policy/provider tests
Review URL: http://codereview.chromium.org/6002015
TBR=danno@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72785 0039d316-1c4b-4281-b951-d872f2087c98
29 files changed, 309 insertions, 338 deletions
diff --git a/chrome/app/DEPS b/chrome/app/DEPS index 95afdc9..d83f0a1 100644 --- a/chrome/app/DEPS +++ b/chrome/app/DEPS @@ -3,7 +3,6 @@ include_rules = [ "+chrome/browser", "+chrome/installer", "+grit", # For generated headers - "+policy", # For generated headers and source "+sandbox", "+tools/memory_watcher", ] diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm index e7c40df..caa46cc 100644 --- a/chrome/app/breakpad_mac.mm +++ b/chrome/app/breakpad_mac.mm @@ -23,8 +23,8 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/env_vars.h" +#include "chrome/common/policy_constants.h" #include "chrome/installer/util/google_update_settings.h" -#include "policy/policy_constants.h" namespace { diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index fc85b26..9fe1032 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -28,10 +28,10 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/env_vars.h" #include "chrome/common/result_codes.h" +#include "chrome/common/policy_constants.h" #include "chrome/installer/util/google_chrome_sxs_distribution.h" #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/install_util.h" -#include "policy/policy_constants.h" namespace { diff --git a/chrome/app/policy/policy_templates.gypi b/chrome/app/policy/policy_templates.gypi index b96e138..4f41c3a 100644 --- a/chrome/app/policy/policy_templates.gypi +++ b/chrome/app/policy/policy_templates.gypi @@ -3,95 +3,7 @@ # found in the LICENSE file. { - 'variables': { - 'policy_out_dir': '<(SHARED_INTERMEDIATE_DIR)/policy', - 'generate_policy_source_script': - ['python', 'tools/build/generate_policy_source.py'], - }, - 'target_defaults': { - 'variables': { - 'policy_target': 0, - }, - 'target_conditions': [ - [ 'policy_target==1', { - 'include_dirs': [ - '<(policy_out_dir)', - ], - 'actions': [ - { - 'variables': - { - 'policy_constant_header': - '<(policy_out_dir)/policy/policy_constants.h', - 'policy_constant_source': - '<(policy_out_dir)/policy/policy_constants.cc', - 'configuration_policy_type_header': - '<(policy_out_dir)/policy/configuration_policy_type.h', - }, - 'inputs': [ - 'policy_templates.json', - '../../tools/build/generate_policy_source.py' - ], - 'outputs': [ - '<(policy_constant_header)', - '<(policy_constant_source)', - '<(configuration_policy_type_header)', - ], - 'action_name': 'generate_policy_source', - 'action': [ - '<@(generate_policy_source_script)', - '--policy-constants-header=<(policy_constant_header)', - '--policy-constants-source=<(policy_constant_source)', - '--policy-type-header=<(configuration_policy_type_header)', - '<(OS)', - '<@(_inputs)', - ], - 'message': 'Generating policy source', - 'process_outputs_as_sources': 1, - }, - ], - }, ], - ], - }, - 'targets': [ - { - 'target_name': 'policy', - 'type': '<(library)', - 'include_dirs': [ - '<(policy_out_dir)', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)/policy' - ], - }, - 'variables': { - 'policy_target': 1, - }, - }, - ], 'conditions': [ - ['OS=="win"', { - 'targets': [ - { - 'target_name': 'policy_win64', - 'type': '<(library)', - 'variables': { - 'policy_target': 1, - }, - 'direct_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)/policy' - ], - }, - 'configurations': { - 'Common_Base': { - 'msvs_target_platform': 'x64', - }, - }, - }, - ], - }], ['OS=="win" or OS=="mac" or OS=="linux"', { 'targets': [ { diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json index 8cc0e7c..291fb8d 100644 --- a/chrome/app/policy/policy_templates.json +++ b/chrome/app/policy/policy_templates.json @@ -715,19 +715,6 @@ </ph>.''', }, { - 'name': 'BlockThirdPartyCookies', - 'type': 'main', - 'supported_on': ['chrome.*:10-'], - 'features': {'dynamic_refresh': 1}, - 'example_value': False, - 'caption': '''Block third party cookies''', - 'desc': '''Blocks third party cookies. - - Enabling this setting prevents cookies from being set by web page elements that are not from the domain that is in the browser's address bar. - - Disabling this setting allows cookies to be set by web page elements that are not from the domain that is in the browser's address bar and prevents users from changing this setting.''', - }, - { 'name': 'DefaultSearchProviderName', 'type': 'string', 'supported_on': ['chrome.*:8-'], diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 757e0b4..1cf13fc 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -8,7 +8,6 @@ include_rules = [ "+chrome/tools/profiles", # For history unit tests. "+chrome/views", "+grit", # For generated headers - "+policy", # For generated headers and source "+ppapi/c", # For various types. "+ppapi/proxy", "+rlz", diff --git a/chrome/browser/policy/asynchronous_policy_provider_unittest.cc b/chrome/browser/policy/asynchronous_policy_provider_unittest.cc index 9d186b8..c6aee70 100644 --- a/chrome/browser/policy/asynchronous_policy_provider_unittest.cc +++ b/chrome/browser/policy/asynchronous_policy_provider_unittest.cc @@ -7,7 +7,7 @@ #include "chrome/browser/policy/asynchronous_policy_test_base.h" #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/mock_configuration_policy_store.h" -#include "policy/policy_constants.h" +#include "chrome/common/policy_constants.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/policy/config_dir_policy_provider_unittest.cc b/chrome/browser/policy/config_dir_policy_provider_unittest.cc index 4bfd49f..67ac917 100644 --- a/chrome/browser/policy/config_dir_policy_provider_unittest.cc +++ b/chrome/browser/policy/config_dir_policy_provider_unittest.cc @@ -13,7 +13,7 @@ #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/mock_configuration_policy_store.h" #include "chrome/common/json_value_serializer.h" -#include "policy/policy_constants.h" +#include "chrome/common/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace policy { @@ -226,7 +226,7 @@ INSTANTIATE_TEST_CASE_P( ConfigDirPolicyProviderValueTest, testing::Values( ValueTestParams::ForStringPolicy( - kPolicyHomepageLocation, + kPolicyHomePage, key::kHomepageLocation), ValueTestParams::ForBooleanPolicy( kPolicyHomepageIsNewTabPage, @@ -235,8 +235,8 @@ INSTANTIATE_TEST_CASE_P( kPolicyRestoreOnStartup, key::kRestoreOnStartup), ValueTestParams::ForListPolicy( - kPolicyRestoreOnStartupURLs, - key::kRestoreOnStartupURLs), + kPolicyURLsToRestoreOnStartup, + key::kURLsToRestoreOnStartup), ValueTestParams::ForBooleanPolicy( kPolicyDefaultSearchProviderEnabled, key::kDefaultSearchProviderEnabled), @@ -304,17 +304,17 @@ INSTANTIATE_TEST_CASE_P( kPolicyAutoFillEnabled, key::kAutoFillEnabled), ValueTestParams::ForStringPolicy( - kPolicyApplicationLocaleValue, + kPolicyApplicationLocale, key::kApplicationLocaleValue), ValueTestParams::ForBooleanPolicy( kPolicySyncDisabled, key::kSyncDisabled), ValueTestParams::ForListPolicy( - kPolicyExtensionInstallWhitelist, - key::kExtensionInstallWhitelist), + kPolicyExtensionInstallAllowList, + key::kExtensionInstallAllowList), ValueTestParams::ForListPolicy( - kPolicyExtensionInstallBlacklist, - key::kExtensionInstallBlacklist), + kPolicyExtensionInstallDenyList, + key::kExtensionInstallDenyList), ValueTestParams::ForBooleanPolicy( kPolicyShowHomeButton, key::kShowHomeButton), diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 9f00c51..2d4ab5f 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -28,8 +28,8 @@ #include "chrome/browser/search_engines/search_terms_data.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/common/notification_service.h" +#include "chrome/common/policy_constants.h" #include "chrome/common/pref_names.h" -#include "policy/policy_constants.h" namespace policy { @@ -150,12 +150,12 @@ class ConfigurationPolicyPrefKeeper const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry ConfigurationPolicyPrefKeeper::kSimplePolicyMap[] = { - { Value::TYPE_STRING, kPolicyHomepageLocation, prefs::kHomePage }, + { Value::TYPE_STRING, kPolicyHomePage, prefs::kHomePage }, { Value::TYPE_BOOLEAN, kPolicyHomepageIsNewTabPage, prefs::kHomePageIsNewTabPage }, { Value::TYPE_INTEGER, kPolicyRestoreOnStartup, prefs::kRestoreOnStartup}, - { Value::TYPE_LIST, kPolicyRestoreOnStartupURLs, + { Value::TYPE_LIST, kPolicyURLsToRestoreOnStartup, prefs::kURLsToRestoreOnStartup }, { Value::TYPE_BOOLEAN, kPolicyAlternateErrorPagesEnabled, prefs::kAlternateErrorPagesEnabled }, @@ -175,13 +175,13 @@ const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry prefs::kPrintingEnabled }, { Value::TYPE_BOOLEAN, kPolicyMetricsReportingEnabled, prefs::kMetricsReportingEnabled }, - { Value::TYPE_STRING, kPolicyApplicationLocaleValue, + { Value::TYPE_STRING, kPolicyApplicationLocale, prefs::kApplicationLocale}, - { Value::TYPE_LIST, kPolicyExtensionInstallWhitelist, + { Value::TYPE_LIST, kPolicyExtensionInstallAllowList, prefs::kExtensionInstallAllowList}, - { Value::TYPE_LIST, kPolicyExtensionInstallBlacklist, + { Value::TYPE_LIST, kPolicyExtensionInstallDenyList, prefs::kExtensionInstallDenyList}, - { Value::TYPE_LIST, kPolicyExtensionInstallForcelist, + { Value::TYPE_LIST, kPolicyExtensionInstallForceList, prefs::kExtensionInstallForceList}, { Value::TYPE_LIST, kPolicyDisabledPlugins, prefs::kPluginsPluginsBlacklist}, @@ -747,12 +747,12 @@ ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore() { const ConfigurationPolicyProvider::PolicyDefinitionList* ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { static ConfigurationPolicyProvider::PolicyDefinitionList::Entry entries[] = { - { kPolicyHomepageLocation, Value::TYPE_STRING, key::kHomepageLocation }, + { kPolicyHomePage, Value::TYPE_STRING, key::kHomepageLocation }, { kPolicyHomepageIsNewTabPage, Value::TYPE_BOOLEAN, key::kHomepageIsNewTabPage }, { kPolicyRestoreOnStartup, Value::TYPE_INTEGER, key::kRestoreOnStartup }, - { kPolicyRestoreOnStartupURLs, Value::TYPE_LIST, - key::kRestoreOnStartupURLs }, + { kPolicyURLsToRestoreOnStartup, Value::TYPE_LIST, + key::kURLsToRestoreOnStartup }, { kPolicyDefaultSearchProviderEnabled, Value::TYPE_BOOLEAN, key::kDefaultSearchProviderEnabled }, { kPolicyDefaultSearchProviderName, Value::TYPE_STRING, @@ -791,15 +791,15 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { key::kPasswordManagerAllowShowPasswords }, { kPolicyAutoFillEnabled, Value::TYPE_BOOLEAN, key::kAutoFillEnabled }, { kPolicyDisabledPlugins, Value::TYPE_LIST, key::kDisabledPlugins }, - { kPolicyApplicationLocaleValue, Value::TYPE_STRING, + { kPolicyApplicationLocale, Value::TYPE_STRING, key::kApplicationLocaleValue }, { kPolicySyncDisabled, Value::TYPE_BOOLEAN, key::kSyncDisabled }, - { kPolicyExtensionInstallWhitelist, Value::TYPE_LIST, - key::kExtensionInstallWhitelist }, - { kPolicyExtensionInstallBlacklist, Value::TYPE_LIST, - key::kExtensionInstallBlacklist }, - { kPolicyExtensionInstallForcelist, Value::TYPE_LIST, - key::kExtensionInstallForcelist }, + { kPolicyExtensionInstallAllowList, Value::TYPE_LIST, + key::kExtensionInstallAllowList }, + { kPolicyExtensionInstallDenyList, Value::TYPE_LIST, + key::kExtensionInstallDenyList }, + { kPolicyExtensionInstallForceList, Value::TYPE_LIST, + key::kExtensionInstallForceList }, { kPolicyShowHomeButton, Value::TYPE_BOOLEAN, key::kShowHomeButton }, { kPolicyPrintingEnabled, Value::TYPE_BOOLEAN, key::kPrintingEnabled }, { kPolicyJavascriptEnabled, Value::TYPE_BOOLEAN, key::kJavascriptEnabled }, diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index 759591a..0ad9eb6d 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -71,11 +71,11 @@ INSTANTIATE_TEST_CASE_P( ConfigurationPolicyPrefStoreListTestInstance, ConfigurationPolicyPrefStoreListTest, testing::Values( - TypeAndName(kPolicyRestoreOnStartupURLs, + TypeAndName(kPolicyURLsToRestoreOnStartup, prefs::kURLsToRestoreOnStartup), - TypeAndName(kPolicyExtensionInstallWhitelist, + TypeAndName(kPolicyExtensionInstallAllowList, prefs::kExtensionInstallAllowList), - TypeAndName(kPolicyExtensionInstallBlacklist, + TypeAndName(kPolicyExtensionInstallDenyList, prefs::kExtensionInstallDenyList), TypeAndName(kPolicyDisabledPlugins, prefs::kPluginsPluginsBlacklist))); @@ -105,11 +105,11 @@ INSTANTIATE_TEST_CASE_P( ConfigurationPolicyPrefStoreStringTestInstance, ConfigurationPolicyPrefStoreStringTest, testing::Values( - TypeAndName(kPolicyHomepageLocation, + TypeAndName(kPolicyHomePage, prefs::kHomePage), - TypeAndName(kPolicyApplicationLocaleValue, + TypeAndName(kPolicyApplicationLocale, prefs::kApplicationLocale), - TypeAndName(kPolicyApplicationLocaleValue, + TypeAndName(kPolicyApplicationLocale, prefs::kApplicationLocale), TypeAndName(kPolicyAuthSchemes, prefs::kAuthSchemes), @@ -670,7 +670,7 @@ TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Refresh) { store_->GetValue(prefs::kHomePage, NULL)); EXPECT_CALL(observer_, OnPrefValueChanged(prefs::kHomePage)).Times(1); - provider_.AddPolicy(kPolicyHomepageLocation, + provider_.AddPolicy(kPolicyHomePage, Value::CreateStringValue("http://www.chromium.org")); store_->OnUpdatePolicy(); Mock::VerifyAndClearExpectations(&observer_); @@ -683,7 +683,7 @@ TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Refresh) { Mock::VerifyAndClearExpectations(&observer_); EXPECT_CALL(observer_, OnPrefValueChanged(prefs::kHomePage)).Times(1); - provider_.RemovePolicy(kPolicyHomepageLocation); + provider_.RemovePolicy(kPolicyHomePage); store_->OnUpdatePolicy(); Mock::VerifyAndClearExpectations(&observer_); EXPECT_EQ(PrefStore::READ_NO_VALUE, diff --git a/chrome/browser/policy/configuration_policy_provider_delegate_win.cc b/chrome/browser/policy/configuration_policy_provider_delegate_win.cc index 7e93486..1f2f467 100644 --- a/chrome/browser/policy/configuration_policy_provider_delegate_win.cc +++ b/chrome/browser/policy/configuration_policy_provider_delegate_win.cc @@ -7,7 +7,7 @@ #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/win/registry.h" -#include "policy/policy_constants.h" +#include "chrome/common/policy_constants.h" using base::win::RegKey; diff --git a/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc b/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc index c0f1e30..d221f9a 100644 --- a/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc +++ b/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc @@ -11,7 +11,7 @@ #include "chrome/browser/policy/configuration_policy_provider_mac.h" #include "chrome/browser/policy/mock_configuration_policy_store.h" #include "chrome/browser/preferences_mock_mac.h" -#include "policy/policy_constants.h" +#include "chrome/common/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace policy { @@ -200,7 +200,7 @@ INSTANTIATE_TEST_CASE_P( ConfigurationPolicyProviderMacTest, testing::Values( PolicyTestParams::ForStringPolicy( - kPolicyHomepageLocation, + kPolicyHomePage, key::kHomepageLocation), PolicyTestParams::ForBooleanPolicy( kPolicyHomepageIsNewTabPage, @@ -209,8 +209,8 @@ INSTANTIATE_TEST_CASE_P( kPolicyRestoreOnStartup, key::kRestoreOnStartup), PolicyTestParams::ForListPolicy( - kPolicyRestoreOnStartupURLs, - key::kRestoreOnStartupURLs), + kPolicyURLsToRestoreOnStartup, + key::kURLsToRestoreOnStartup), PolicyTestParams::ForBooleanPolicy( kPolicyDefaultSearchProviderEnabled, key::kDefaultSearchProviderEnabled), @@ -278,17 +278,17 @@ INSTANTIATE_TEST_CASE_P( kPolicyAutoFillEnabled, key::kAutoFillEnabled), PolicyTestParams::ForStringPolicy( - kPolicyApplicationLocaleValue, + kPolicyApplicationLocale, key::kApplicationLocaleValue), PolicyTestParams::ForBooleanPolicy( kPolicySyncDisabled, key::kSyncDisabled), PolicyTestParams::ForListPolicy( - kPolicyExtensionInstallWhitelist, - key::kExtensionInstallWhitelist), + kPolicyExtensionInstallAllowList, + key::kExtensionInstallAllowList), PolicyTestParams::ForListPolicy( - kPolicyExtensionInstallBlacklist, - key::kExtensionInstallBlacklist), + kPolicyExtensionInstallDenyList, + key::kExtensionInstallDenyList), PolicyTestParams::ForBooleanPolicy( kPolicyShowHomeButton, key::kShowHomeButton), diff --git a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc b/chrome/browser/policy/configuration_policy_provider_win_unittest.cc index eed2c06..1d2a9ee 100644 --- a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc +++ b/chrome/browser/policy/configuration_policy_provider_win_unittest.cc @@ -17,8 +17,8 @@ #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/configuration_policy_provider_win.h" #include "chrome/browser/policy/mock_configuration_policy_store.h" +#include "chrome/common/policy_constants.h" #include "chrome/common/pref_names.h" -#include "policy/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" using base::win::RegKey; @@ -358,7 +358,7 @@ INSTANTIATE_TEST_CASE_P( ConfigurationPolicyProviderWinTest, testing::Values( PolicyTestParams::ForStringPolicy( - kPolicyHomepageLocation, + kPolicyHomePage, key::kHomepageLocation), PolicyTestParams::ForBooleanPolicy( kPolicyHomepageIsNewTabPage, @@ -367,8 +367,8 @@ INSTANTIATE_TEST_CASE_P( kPolicyRestoreOnStartup, key::kRestoreOnStartup), PolicyTestParams::ForListPolicy( - kPolicyRestoreOnStartupURLs, - key::kRestoreOnStartupURLs), + kPolicyURLsToRestoreOnStartup, + key::kURLsToRestoreOnStartup), PolicyTestParams::ForBooleanPolicy( kPolicyDefaultSearchProviderEnabled, key::kDefaultSearchProviderEnabled), @@ -436,14 +436,14 @@ INSTANTIATE_TEST_CASE_P( kPolicySyncDisabled, key::kSyncDisabled), PolicyTestParams::ForStringPolicy( - kPolicyApplicationLocaleValue, + kPolicyApplicationLocale, key::kApplicationLocaleValue), PolicyTestParams::ForListPolicy( - kPolicyExtensionInstallWhitelist, - key::kExtensionInstallWhitelist), + kPolicyExtensionInstallAllowList, + key::kExtensionInstallAllowList), PolicyTestParams::ForListPolicy( - kPolicyExtensionInstallBlacklist, - key::kExtensionInstallBlacklist), + kPolicyExtensionInstallDenyList, + key::kExtensionInstallDenyList), PolicyTestParams::ForBooleanPolicy( kPolicyShowHomeButton, key::kShowHomeButton), diff --git a/chrome/browser/policy/configuration_policy_store_interface.h b/chrome/browser/policy/configuration_policy_store_interface.h index c88f07f..e697ed1 100644 --- a/chrome/browser/policy/configuration_policy_store_interface.h +++ b/chrome/browser/policy/configuration_policy_store_interface.h @@ -7,14 +7,72 @@ #pragma once #include "base/basictypes.h" -// configuration_policy_type.h is generated. See policy_template.json for -// policy definitions. -#include "policy/configuration_policy_type.h" class Value; namespace policy { +enum ConfigurationPolicyType { + kPolicyHomePage, + kPolicyHomepageIsNewTabPage, + kPolicyRestoreOnStartup, + kPolicyURLsToRestoreOnStartup, + kPolicyDefaultSearchProviderEnabled, + kPolicyDefaultSearchProviderName, + kPolicyDefaultSearchProviderKeyword, + kPolicyDefaultSearchProviderSearchURL, + kPolicyDefaultSearchProviderSuggestURL, + kPolicyDefaultSearchProviderIconURL, + kPolicyDefaultSearchProviderInstantURL, + kPolicyDefaultSearchProviderEncodings, + kPolicyDisableSpdy, + kPolicyProxyMode, + kPolicyProxyServerMode, + kPolicyProxyServer, + kPolicyProxyPacUrl, + kPolicyProxyBypassList, + kPolicyAlternateErrorPagesEnabled, + kPolicySearchSuggestEnabled, + kPolicyDnsPrefetchingEnabled, + kPolicySafeBrowsingEnabled, + kPolicyMetricsReportingEnabled, + kPolicyPasswordManagerEnabled, + kPolicyPasswordManagerAllowShowPasswords, + kPolicyAutoFillEnabled, + kPolicySyncDisabled, + kPolicyApplicationLocale, + kPolicyExtensionInstallAllowList, + kPolicyExtensionInstallDenyList, + kPolicyShowHomeButton, + kPolicyDisabledPlugins, + kPolicyPrintingEnabled, + kPolicyChromeFrameRendererSettings, + kPolicyRenderInChromeFrameList, + kPolicyRenderInHostList, + kPolicyJavascriptEnabled, + kPolicySavingBrowserHistoryDisabled, + kPolicyDeveloperToolsDisabled, + kPolicyBlockThirdPartyCookies, + kPolicyDefaultCookiesSetting, + kPolicyDefaultImagesSetting, + kPolicyDefaultJavaScriptSetting, + kPolicyDefaultPluginsSetting, + kPolicyDefaultPopupsSetting, + kPolicyDefaultNotificationSetting, + kPolicyDefaultGeolocationSetting, + kPolicyExtensionInstallForceList, + kPolicyChromeOsLockOnIdleSuspend, + kPolicyAuthSchemes, + kPolicyDisableAuthNegotiateCnameLookup, + kPolicyEnableAuthNegotiatePort, + kPolicyAuthServerWhitelist, + kPolicyAuthNegotiateDelegateWhitelist, + kPolicyGSSAPILibraryName, + kPolicyDisable3DAPIs, + kPolicyPolicyRefreshRate, +}; + + // Constants for the "Proxy Server Mode" defined in the policies. // Note that these diverge from internal presentation defined in // ProxyPrefs::ProxyMode for legacy reasons. The following four diff --git a/chrome/browser/policy/device_management_policy_provider_unittest.cc b/chrome/browser/policy/device_management_policy_provider_unittest.cc index d0a0eaa..55ba883 100644 --- a/chrome/browser/policy/device_management_policy_provider_unittest.cc +++ b/chrome/browser/policy/device_management_policy_provider_unittest.cc @@ -16,9 +16,9 @@ #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/notification_observer_mock.h" #include "chrome/common/notification_service.h" +#include "chrome/common/policy_constants.h" #include "chrome/test/testing_device_token_fetcher.h" #include "chrome/test/testing_profile.h" -#include "policy/policy_constants.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/policy/file_based_policy_provider_unittest.cc b/chrome/browser/policy/file_based_policy_provider_unittest.cc index 2948f5f..1bb2185 100644 --- a/chrome/browser/policy/file_based_policy_provider_unittest.cc +++ b/chrome/browser/policy/file_based_policy_provider_unittest.cc @@ -7,7 +7,7 @@ #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/configuration_policy_store_interface.h" #include "chrome/browser/policy/file_based_policy_provider.h" -#include "policy/policy_constants.h" +#include "chrome/common/policy_constants.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 4455b2f..1f421cb 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -38,7 +38,6 @@ 'common_nacl_win64', 'common_constants_win64', 'installer_util_nacl_win64', - 'policy_win64', ], 'allocator_target': '../base/allocator/allocator.gyp:allocator', 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', @@ -850,7 +849,6 @@ 'browser/sync/protocol/sync_proto.gyp:sync_proto_cpp', 'common_constants', 'common_net', - 'policy', 'sync', 'sync_notifier', ], @@ -1796,7 +1794,6 @@ 'dependencies': [ 'common_constants', 'installer_util', - 'policy', '../base/base.gyp:base', '../breakpad/breakpad.gyp:breakpad_handler', '../breakpad/breakpad.gyp:breakpad_sender', diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 6d5cf63..b2d44d1 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -20,7 +20,6 @@ 'profile_import', 'browser/sync/protocol/sync_proto.gyp:sync_proto_cpp', 'browser/policy/proto/device_management_proto.gyp:device_management_proto_cpp', - 'policy', 'safe_browsing_csd_proto', 'safe_browsing_report_proto', 'syncapi', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 727f61b..2cb8e92 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -203,7 +203,6 @@ 'common_constants', 'common_net', 'default_plugin/default_plugin.gyp:default_plugin', - 'policy', 'theme_resources', '../app/app.gyp:app_base', '../app/app.gyp:app_resources', @@ -582,7 +581,6 @@ 'chrome_resources', 'chrome_strings', 'common_constants_win64', - 'policy_win64', '../app/app.gyp:app_base_nacl_win64', '../app/app.gyp:app_resources', '../base/base.gyp:base_nacl_win64', diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index 319a078..1d9768c 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi @@ -443,7 +443,6 @@ 'dependencies': [ 'installer_util', 'installer_util_strings', - 'policy', '../breakpad/breakpad.gyp:breakpad_handler', '../breakpad/breakpad.gyp:breakpad_sender', '../sandbox/sandbox.gyp:sandbox', @@ -490,10 +489,9 @@ # On Windows make sure we've built Win64 version of chrome_dll, # which contains all of the library code with Chromium # functionality. + 'chrome_dll_nacl_win64', 'installer_util_nacl_win64', 'common_constants_win64', - 'chrome_dll_nacl_win64', - 'policy_win64', '../breakpad/breakpad.gyp:breakpad_handler_win64', '../breakpad/breakpad.gyp:breakpad_sender_win64', '../base/base.gyp:base_nacl_win64', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 2fbdfd6..ee495e0 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -31,7 +31,6 @@ 'chrome_strings', 'browser/sync/protocol/sync_proto.gyp:sync_proto_cpp', 'browser/policy/proto/device_management_proto.gyp:device_management_proto_cpp', - 'policy', 'theme_resources', '../base/base.gyp:test_support_base', '../ipc/ipc.gyp:test_support_ipc', @@ -172,7 +171,6 @@ 'test_support_common', 'chrome_resources', 'chrome_strings', - 'policy', 'theme_resources', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', @@ -222,7 +220,6 @@ 'test_support_common', 'chrome_resources', 'chrome_strings', - 'policy', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', ], @@ -250,7 +247,6 @@ 'msvs_guid': 'D2250C20-3A94-4FB9-AF73-11BC5B73884B', 'dependencies': [ 'browser', - 'policy', 'renderer', 'test_support_common', 'test_support_ui', @@ -309,7 +305,6 @@ 'chrome_resources', 'chrome_strings', 'debugger', - 'policy', 'syncapi', 'test_support_common', 'test_support_ui', @@ -916,7 +911,6 @@ 'common', 'chrome_resources', 'chrome_strings', - 'policy', 'test_support_ui', '../base/base.gyp:base', '../build/temp_gyp/googleurl.gyp:googleurl', @@ -984,7 +978,6 @@ 'chrome_resources', 'chrome_strings', 'common', - 'policy', 'profile_import', 'renderer', 'service', @@ -1974,7 +1967,6 @@ 'chrome', 'chrome_resources', 'chrome_strings', - 'policy', 'profile_import', 'renderer', 'test_support_common', @@ -2355,7 +2347,6 @@ 'msvs_guid': 'BBF2BC2F-7CD8-463E-BE88-CB81AAD92BFE', 'dependencies': [ 'chrome', - 'policy', 'test_support_common', '../app/app.gyp:app_resources', '../base/base.gyp:base', @@ -2610,7 +2601,6 @@ 'dependencies': [ 'chrome', 'debugger', - 'policy', 'test_support_common', 'test_support_ui', 'theme_resources', @@ -2645,7 +2635,6 @@ 'dependencies': [ 'chrome', 'debugger', - 'policy', 'test_support_common', 'test_support_ui', 'theme_resources', @@ -2675,7 +2664,6 @@ 'dependencies': [ 'chrome', 'debugger', - 'policy', 'test_support_common', 'test_support_ui', 'theme_resources', @@ -2853,7 +2841,6 @@ 'chrome', 'chrome_resources', 'common', - 'policy', 'profile_import', 'renderer', 'chrome_strings', @@ -3016,7 +3003,6 @@ 'chrome', 'chrome_resources', 'chrome_strings', - 'policy', 'renderer', 'test_support_common', '../app/app.gyp:app_base', @@ -3112,7 +3098,6 @@ 'chrome', 'chrome_resources', 'chrome_strings', - 'policy', 'test_support_common', 'test_support_ui', '../skia/skia.gyp:skia', @@ -3221,7 +3206,6 @@ 'dependencies': [ 'test_support_common', 'browser', - 'policy', 'renderer', 'syncapi', '../base/base.gyp:base', @@ -3299,7 +3283,6 @@ 'dependencies': [ 'chrome_resources', 'chrome_strings', - 'policy', 'test_support_common', 'test_support_ui', '../skia/skia.gyp:skia', @@ -3353,7 +3336,6 @@ 'product_prefix': '_', 'dependencies': [ 'chrome', - 'policy', 'debugger', 'syncapi', 'test_support_common', diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 584bd9e..957c83f 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -294,7 +294,7 @@ bool PathProvider(int key, FilePath* result) { if (!file_util::PathExists(cur)) // we don't want to create this return false; break; -#if defined(OS_POSIX) && !defined(OS_MACOSX) +#if !defined(OS_MACOSX) && defined(OS_POSIX) case chrome::DIR_POLICY_FILES: { #if defined(GOOGLE_CHROME_BUILD) cur = FilePath(FILE_PATH_LITERAL("/etc/opt/chrome/policies")); diff --git a/chrome/common/policy_constants.cc b/chrome/common/policy_constants.cc new file mode 100644 index 0000000..f02264c --- /dev/null +++ b/chrome/common/policy_constants.cc @@ -0,0 +1,94 @@ +// Copyright (c) 2010 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. + +#include "chrome/common/policy_constants.h" + +namespace policy { + +#if defined(OS_WIN) +#if defined(GOOGLE_CHROME_BUILD) +const wchar_t kRegistrySubKey[] = L"SOFTWARE\\Policies\\Google\\Chrome"; +#else +const wchar_t kRegistrySubKey[] = L"SOFTWARE\\Policies\\Chromium"; +#endif +#endif + +namespace key { + +const char kHomepageLocation[] = "HomepageLocation"; +const char kHomepageIsNewTabPage[] = "HomepageIsNewTabPage"; +const char kRestoreOnStartup[] = "RestoreOnStartup"; +const char kURLsToRestoreOnStartup[] = "RestoreOnStartupURLs"; +const char kDefaultSearchProviderEnabled[] = "DefaultSearchProviderEnabled"; +const char kDefaultSearchProviderName[] = "DefaultSearchProviderName"; +const char kDefaultSearchProviderKeyword[] = "DefaultSearchProviderKeyword"; +const char kDefaultSearchProviderSearchURL[] = + "DefaultSearchProviderSearchURL"; +const char kDefaultSearchProviderSuggestURL[] = + "DefaultSearchProviderSuggestURL"; +const char kDefaultSearchProviderInstantURL[] = + "DefaultSearchProviderInstantURL"; +const char kDefaultSearchProviderIconURL[] = + "DefaultSearchProviderIconURL"; +const char kDefaultSearchProviderEncodings[] = + "DefaultSearchProviderEncodings"; +const char kDisableSpdy[] = "DisableSpdy"; +const char kProxyMode[] = "ProxyMode"; +// Deprecated name of policy to set proxy server mode +const char kProxyServerMode[] = "ProxyServerMode"; +const char kProxyServer[] = "ProxyServer"; +const char kProxyPacUrl[] = "ProxyPacUrl"; +const char kProxyBypassList[] = "ProxyBypassList"; +const char kAlternateErrorPagesEnabled[] = "AlternateErrorPagesEnabled"; +const char kSearchSuggestEnabled[] = "SearchSuggestEnabled"; +const char kDnsPrefetchingEnabled[] = "DnsPrefetchingEnabled"; +const char kSafeBrowsingEnabled[] = "SafeBrowsingEnabled"; +const char kMetricsReportingEnabled[] = "MetricsReportingEnabled"; +const char kPasswordManagerEnabled[] = "PasswordManagerEnabled"; +const char kPasswordManagerAllowShowPasswords[] = + "PasswordManagerAllowShowPasswords"; +const char kDisabledPlugins[] = "DisabledPlugins"; +const char kAutoFillEnabled[] = "AutoFillEnabled"; +const char kApplicationLocaleValue[] = "ApplicationLocaleValue"; +const char kSyncDisabled[] = "SyncDisabled"; +const char kExtensionInstallAllowList[] = "ExtensionInstallWhitelist"; +const char kExtensionInstallDenyList[] = "ExtensionInstallBlacklist"; +const char kExtensionInstallForceList[] = "ExtensionInstallForcelist"; +const char kShowHomeButton[] = "ShowHomeButton"; +const char kPrintingEnabled[] = "PrintingEnabled"; +const char kJavascriptEnabled[] = "JavascriptEnabled"; +const char kSavingBrowserHistoryDisabled[] = "SavingBrowserHistoryDisabled"; +const char kDeveloperToolsDisabled[] = "DeveloperToolsDisabled"; +const char kBlockThirdPartyCookies[] = "BlockThirdPartyCookies"; +const char kDefaultCookiesSetting[] = "DefaultCookiesSetting"; +const char kDefaultImagesSetting[] = "DefaultImagesSetting"; +const char kDefaultJavaScriptSetting[] = "DefaultJavaScriptSetting"; +const char kDefaultPluginsSetting[] = "DefaultPluginsSetting"; +const char kDefaultPopupsSetting[] = "DefaultPopupsSetting"; +const char kDefaultNotificationSetting[] = "DefaultNotificationSetting"; +const char kDefaultGeolocationSetting[] = "DefaultGeolocationSetting"; +const char kAuthSchemes[] = "AuthSchemes"; +const char kDisableAuthNegotiateCnameLookup[] = + "DisableAuthNegotiateCnameLookup"; +const char kEnableAuthNegotiatePort[] = "EnableAuthNegotiatePort"; +const char kAuthServerWhitelist[] = "AuthServerWhitelist"; +const char kAuthNegotiateDelegateWhitelist[] = "AuthNegotiateDelegateWhitelist"; +const char kGSSAPILibraryName[] = "GSSAPILibraryName"; +const char kDisable3DAPIs[] = "Disable3DAPIs"; +const char kPolicyRefreshRate[] = "PolicyRefreshRate"; + +// Chrome Frame specific policy constants +const char kChromeFrameRendererSettings[] = "ChromeFrameRendererSettings"; +const char kRenderInChromeFrameList[] = "RenderInChromeFrameList"; +const char kRenderInHostList[] = "RenderInHostList"; +const char kChromeFrameContentTypes[] = "ChromeFrameContentTypes"; + +#if defined(OS_CHROMEOS) +// ChromeOS policy constants +const char kChromeOsLockOnIdleSuspend[] = "ChromeOsLockOnIdleSuspend"; +#endif + +} // namespace key + +} // namespace policy diff --git a/chrome/common/policy_constants.h b/chrome/common/policy_constants.h new file mode 100644 index 0000000..22a41ba --- /dev/null +++ b/chrome/common/policy_constants.h @@ -0,0 +1,90 @@ +// Copyright (c) 2010 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. + +#ifndef CHROME_COMMON_POLICY_CONSTANTS_H_ +#define CHROME_COMMON_POLICY_CONSTANTS_H_ +#pragma once + +#include "build/build_config.h" + +namespace policy { + +#if defined(OS_WIN) +// The windows registry path we read the policy configuration from. +extern const wchar_t kRegistrySubKey[]; +#endif + +// Key names for the policy settings. +namespace key { + +extern const char kHomepageLocation[]; +extern const char kHomepageIsNewTabPage[]; +extern const char kRestoreOnStartup[]; +extern const char kURLsToRestoreOnStartup[]; +extern const char kDefaultSearchProviderEnabled[]; +extern const char kDefaultSearchProviderName[]; +extern const char kDefaultSearchProviderKeyword[]; +extern const char kDefaultSearchProviderSearchURL[]; +extern const char kDefaultSearchProviderSuggestURL[]; +extern const char kDefaultSearchProviderInstantURL[]; +extern const char kDefaultSearchProviderIconURL[]; +extern const char kDefaultSearchProviderEncodings[]; +extern const char kDisableSpdy[]; +extern const char kProxyMode[]; +extern const char kProxyServerMode[]; +extern const char kProxyServer[]; +extern const char kProxyPacUrl[]; +extern const char kProxyBypassList[]; +extern const char kAlternateErrorPagesEnabled[]; +extern const char kSearchSuggestEnabled[]; +extern const char kDnsPrefetchingEnabled[]; +extern const char kSafeBrowsingEnabled[]; +extern const char kMetricsReportingEnabled[]; +extern const char kPasswordManagerEnabled[]; +extern const char kPasswordManagerAllowShowPasswords[]; +extern const char kDisabledPlugins[]; +extern const char kAutoFillEnabled[]; +extern const char kApplicationLocaleValue[]; +extern const char kSyncDisabled[]; +extern const char kExtensionInstallAllowList[]; +extern const char kExtensionInstallDenyList[]; +extern const char kExtensionInstallForceList[]; +extern const char kShowHomeButton[]; +extern const char kPrintingEnabled[]; +extern const char kJavascriptEnabled[]; +extern const char kSavingBrowserHistoryDisabled[]; +extern const char kDeveloperToolsDisabled[]; +extern const char kBlockThirdPartyCookies[]; +extern const char kDefaultCookiesSetting[]; +extern const char kDefaultImagesSetting[]; +extern const char kDefaultJavaScriptSetting[]; +extern const char kDefaultPluginsSetting[]; +extern const char kDefaultPopupsSetting[]; +extern const char kDefaultNotificationSetting[]; +extern const char kDefaultGeolocationSetting[]; +extern const char kAuthSchemes[]; +extern const char kDisableAuthNegotiateCnameLookup[]; +extern const char kEnableAuthNegotiatePort[]; +extern const char kAuthServerWhitelist[]; +extern const char kAuthNegotiateDelegateWhitelist[]; +extern const char kGSSAPILibraryName[]; +extern const char kDisable3DAPIs[]; +extern const char kPolicyRefreshRate[]; + +// Chrome Frame specific policy constants +extern const char kChromeFrameRendererSettings[]; +extern const char kRenderInChromeFrameList[]; +extern const char kRenderInHostList[]; +extern const char kChromeFrameContentTypes[]; + +#if defined(OS_CHROMEOS) +// ChromeOS policy constants +extern const char kChromeOsLockOnIdleSuspend[]; +#endif + +} // namespace key + +} // namespace policy + +#endif // CHROME_COMMON_POLICY_CONSTANTS_H_ diff --git a/chrome/common_constants.gypi b/chrome/common_constants.gypi index 47b4d58..07eee8c 100644 --- a/chrome/common_constants.gypi +++ b/chrome/common_constants.gypi @@ -26,6 +26,8 @@ 'common/json_value_serializer.h', 'common/net/gaia/gaia_constants.cc', 'common/net/gaia/gaia_constants.h', + 'common/policy_constants.cc', + 'common/policy_constants.h', 'common/pref_names.cc', 'common/pref_names.h', ], diff --git a/chrome/tools/build/generate_policy_source.py b/chrome/tools/build/generate_policy_source.py deleted file mode 100644 index 1051092..0000000 --- a/chrome/tools/build/generate_policy_source.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/python -# 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. - -'''python %prog [options] platform template - -platform specifies which platform source is being generated for - and can be one of (win, mac, linux). -template is the path to a .json policy template file.''' - -from __future__ import with_statement -from optparse import OptionParser -import sys; - - -CHROME_SUBKEY = 'SOFTWARE\\\\Policies\\\\Google\\\\Chrome'; -CHROMIUM_SUBKEY = 'SOFTWARE\\\\Policies\\\\Chromium'; - - -def main(): - parser = OptionParser(usage=__doc__); - parser.add_option("--pch", "--policy-constants-header", dest="header_path", - help="generate header file of policy constants", - metavar="FILE"); - parser.add_option("--pcc", "--policy-constants-source", dest="source_path", - help="generate source file of policy constants", - metavar="FILE"); - parser.add_option("--pth", "--policy-type-header", dest="type_path", - help="generate header file for policy type enumeration", - metavar="FILE"); - - (opts, args) = parser.parse_args(); - - if len(args) < 2 or len(args) > 2: - print "exactly one platform and input file must be specified." - parser.print_help() - sys.exit(2) - template_file_contents = _LoadJSONFile(args[1]); - if opts.header_path is not None: - _WritePolicyConstantHeader(template_file_contents, - args, - opts); - if opts.source_path is not None: - _WritePolicyConstantSource(template_file_contents, - args, - opts); - if opts.type_path is not None: - _WritePolicyTypeEnumerationHeader(template_file_contents, - args, - opts); - - -def _OutputGeneratedWarningForC(f, template_file_path): - f.write('//\n' - '// DO NOT MODIFY THIS FILE DIRECTLY!\n' - '// IT IS GENERATED BY generate_policy_source.py\n' - '// FROM ' + template_file_path + ' \n' - '//\n\n') - - -def _WritePolicyConstantHeader(template_file_contents, args, opts): - platform = args[0]; - with open(opts.header_path, "w") as f: - _OutputGeneratedWarningForC(f, args[1]) - f.write('#ifndef CHROME_COMMON_POLICY_CONSTANTS_H_\n' - '#define CHROME_COMMON_POLICY_CONSTANTS_H_\n' - '#pragma once\n' - '\n' - 'namespace policy {\n\n') - if platform == "win": - f.write('// The windows registry path where policy configuration ' - 'resides.\nextern const wchar_t kRegistrySubKey[];\n\n') - f.write('// Key names for the policy settings.\n' - 'namespace key {\n\n') - for policy_name in _GetPolicyNameList(template_file_contents): - f.write('extern const char k' + policy_name + '[];\n') - f.write('\n} // namespace key\n\n' - '} // namespace policy\n\n' - '#endif // CHROME_COMMON_POLICY_CONSTANTS_H_\n') - - -def _WritePolicyConstantSource(template_file_contents, args, opts): - platform = args[0]; - with open(opts.source_path, "w") as f: - _OutputGeneratedWarningForC(f, args[1]) - f.write('#include "policy/policy_constants.h"\n' - '\n' - 'namespace policy {\n' - '\n') - if platform == "win": - f.write('#if defined(GOOGLE_CHROME_BUILD)\n' - 'const wchar_t kRegistrySubKey[] = ' - 'L"' + CHROME_SUBKEY + '";\n' - '#else\n' - 'const wchar_t kRegistrySubKey[] = ' - 'L"' + CHROMIUM_SUBKEY + '";\n' - '#endif\n\n') - f.write('namespace key {\n\n') - for policy_name in _GetPolicyNameList(template_file_contents): - f.write('const char k%s[] = "%s";\n' % (policy_name, policy_name)) - f.write('\n} // namespace key\n\n' - '} // namespace policy\n') - - -def _WritePolicyTypeEnumerationHeader(template_file_contents, args, opts): - with open(opts.type_path, "w") as f: - _OutputGeneratedWarningForC(f, args[1]) - f.write('#ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_TYPE_H_\n' - '#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_TYPE_H_\n' - '#pragma once\n' - '\n' - 'namespace policy {\n' - '\n' - 'enum ConfigurationPolicyType {\n') - for policy_name in _GetPolicyNameList(template_file_contents): - f.write(' kPolicy' + policy_name + ",\n"); - f.write('};\n\n' - '} // namespace policy\n\n' - '#endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_TYPE_H_\n') - - -def _GetPolicyNameList(template_file_contents): - policy_names = []; - for policy in template_file_contents['policy_definitions']: - if policy['type'] == 'group': - for sub_policy in policy['policies']: - policy_names.append(sub_policy['name']) - else: - policy_names.append(policy['name']) - policy_names.sort() - return policy_names - - -def _LoadJSONFile(json_file): - with open(json_file, "r") as f: - text = f.read() - return eval(text) - - -if __name__ == '__main__': - main(); diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp index de69141..9527440 100644 --- a/chrome_frame/chrome_frame.gyp +++ b/chrome_frame/chrome_frame.gyp @@ -146,7 +146,6 @@ '../base/base.gyp:test_support_base', '../ceee/ie/common/common.gyp:ie_common', '../ceee/testing/utils/test_utils.gyp:test_utils', - '../chrome/chrome.gyp:policy', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', 'chrome_frame_ie', @@ -796,7 +795,6 @@ '../ceee/ie/common/common.gyp:ie_common', '../ceee/ie/common/common.gyp:ie_guids', '../chrome/chrome.gyp:common', - '../chrome/chrome.gyp:policy', '../chrome/chrome.gyp:utility', '../build/temp_gyp/googleurl.gyp:googleurl', '../third_party/libxml/libxml.gyp:libxml', diff --git a/chrome_frame/policy_settings.cc b/chrome_frame/policy_settings.cc index a6741a3..116052b 100644 --- a/chrome_frame/policy_settings.cc +++ b/chrome_frame/policy_settings.cc @@ -10,8 +10,8 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/win/registry.h" +#include "chrome/common/policy_constants.h" #include "chrome_frame/utils.h" -#include "policy/policy_constants.h" namespace { diff --git a/chrome_frame/test/policy_settings_unittest.cc b/chrome_frame/test/policy_settings_unittest.cc index a80d427..c5d7c50 100644 --- a/chrome_frame/test/policy_settings_unittest.cc +++ b/chrome_frame/test/policy_settings_unittest.cc @@ -9,9 +9,9 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "base/win/registry.h" +#include "chrome/common/policy_constants.h" #include "chrome_frame/policy_settings.h" #include "chrome_frame/test/chrome_frame_test_utils.h" -#include "policy/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" using base::win::RegKey; |