diff options
author | brettw <brettw@chromium.org> | 2016-03-22 10:23:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 17:24:57 +0000 |
commit | 25955612a93ebfcc60585267e5dd6ec470380db5 (patch) | |
tree | d5c58c7a744905e09d8ab940ee5f44b7f897eb75 | |
parent | 4192192a724363263fd878f99c7ca38cc42550f7 (diff) | |
download | chromium_src-25955612a93ebfcc60585267e5dd6ec470380db5.zip chromium_src-25955612a93ebfcc60585267e5dd6ec470380db5.tar.gz chromium_src-25955612a93ebfcc60585267e5dd6ec470380db5.tar.bz2 |
Remove configuration policy define
Removes the ability to override the definition of configuration_policy from outside the build, since this no longer works. It is now hardcoded to be on everywhere except iOS.
Renames the define used by syncable_prefs to make more clear this is a local flag only. This is the only code that still needs to use preprocessor based on the presence of policy. I removed the ifdef from the header and always declared the functions to prevent define skew, and just assert if the functions are called inappropriately.
Review URL: https://codereview.chromium.org/1805213002
Cr-Commit-Position: refs/heads/master@{#382595}
-rw-r--r-- | build/common.gypi | 13 | ||||
-rw-r--r-- | build/config/BUILD.gn | 3 | ||||
-rw-r--r-- | build/config/features.gni | 4 | ||||
-rw-r--r-- | components/ownership/BUILD.gn | 5 | ||||
-rw-r--r-- | components/policy/policy_common.gypi | 2 | ||||
-rw-r--r-- | components/syncable_prefs.gypi | 3 | ||||
-rw-r--r-- | components/syncable_prefs/BUILD.gn | 3 | ||||
-rw-r--r-- | components/syncable_prefs/pref_service_syncable_factory.cc | 12 | ||||
-rw-r--r-- | components/syncable_prefs/pref_service_syncable_factory.h | 3 |
9 files changed, 26 insertions, 22 deletions
diff --git a/build/common.gypi b/build/common.gypi index 98d612f..94b3b3a 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -439,8 +439,10 @@ # Remoting compilation is enabled by default. Set to 0 to disable. 'remoting%': 1, - # Configuration policy is enabled by default. Set to 0 to disable. - 'configuration_policy%': 1, + # Configuration policy is enabled by default. Overridden on some + # platforms. This can't be disabled manually since code in src/chrome + # assumes this is enabled. + 'configuration_policy': 1, # Variable safe_browsing is used to control the build time configuration # for safe browsing feature. Safe browsing can be compiled in 3 different @@ -870,7 +872,7 @@ }], ['OS=="ios"', { - 'configuration_policy%': 0, + 'configuration_policy': 0, 'disable_ftp_support%': 1, 'enable_extensions%': 0, 'cld2_table_size%': 0, @@ -1211,7 +1213,7 @@ 'enable_media_router%': '<(enable_media_router)', 'enable_webrtc%': '<(enable_webrtc)', 'chromium_win_pch%': '<(chromium_win_pch)', - 'configuration_policy%': '<(configuration_policy)', + 'configuration_policy': '<(configuration_policy)', 'safe_browsing%': '<(safe_browsing)', 'enable_web_speech%': '<(enable_web_speech)', 'enable_hotwording%': '<(enable_hotwording)', @@ -2790,9 +2792,6 @@ ['enable_browser_cdms==1', { 'defines': ['ENABLE_BROWSER_CDMS'], }], - ['configuration_policy==1', { - 'defines': ['ENABLE_CONFIGURATION_POLICY'], - }], ['notifications==1', { 'defines': ['ENABLE_NOTIFICATIONS'], }], diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index dca62fd..907dff6 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -177,9 +177,6 @@ config("feature_flags") { if (enable_extensions) { defines += [ "ENABLE_EXTENSIONS=1" ] } - if (enable_configuration_policy) { - defines += [ "ENABLE_CONFIGURATION_POLICY" ] - } if (enable_task_manager) { defines += [ "ENABLE_TASK_MANAGER=1" ] } diff --git a/build/config/features.gni b/build/config/features.gni index 27906ec..d17e34c 100644 --- a/build/config/features.gni +++ b/build/config/features.gni @@ -50,8 +50,6 @@ declare_args() { # We always build Google Chrome and Chromecast with proprietary codecs. proprietary_codecs = is_chrome_branded || is_chromecast - enable_configuration_policy = !is_ios - enable_captive_portal_detection = !is_android && !is_ios # Enables use of the session service, which is enabled by default. @@ -179,3 +177,5 @@ use_gconf = is_linux && !is_chromeos && !is_chromecast && !is_headless enable_webvr = is_android use_gio = is_linux && !is_chromeos && !is_chromecast && !is_headless + +enable_configuration_policy = !is_ios diff --git a/components/ownership/BUILD.gn b/components/ownership/BUILD.gn index db101b1..8a9eed2 100644 --- a/components/ownership/BUILD.gn +++ b/components/ownership/BUILD.gn @@ -23,15 +23,12 @@ if (is_chromeos) { deps = [ "//base", "//components/keyed_service/core", + "//components/policy", "//components/policy:policy_component_common", "//components/policy/proto", "//crypto", ] - if (enable_configuration_policy) { - deps += [ "//components/policy" ] - } - if (use_nss_certs) { public_deps = [ "//crypto:platform", diff --git a/components/policy/policy_common.gypi b/components/policy/policy_common.gypi index e9c7cb5..7beb4c5 100644 --- a/components/policy/policy_common.gypi +++ b/components/policy/policy_common.gypi @@ -197,7 +197,7 @@ }, { # configuration_policy==0 # Some of the policy code is always enabled, so that other parts of # Chrome can always interface with the PolicyService without having - # to #ifdef on ENABLE_CONFIGURATION_POLICY. + # to #ifdef. 'sources': [ 'core/common/external_data_fetcher.cc', 'core/common/external_data_fetcher.h', diff --git a/components/syncable_prefs.gypi b/components/syncable_prefs.gypi index e4cfc43..66943f4 100644 --- a/components/syncable_prefs.gypi +++ b/components/syncable_prefs.gypi @@ -32,7 +32,10 @@ ], 'conditions': [ ['configuration_policy==1', { + # This define is only used for compiling the .cc files in this target. + 'defines': [ "SYNCABLE_PREFS_USE_POLICY" ], 'dependencies': [ + 'cloud_policy_code_generate', 'policy_component_browser', 'policy_component_common', ], diff --git a/components/syncable_prefs/BUILD.gn b/components/syncable_prefs/BUILD.gn index d2c94ac..a4977ce 100644 --- a/components/syncable_prefs/BUILD.gn +++ b/components/syncable_prefs/BUILD.gn @@ -27,6 +27,9 @@ source_set("syncable_prefs") { ] if (enable_configuration_policy) { + # This define is only used for compiling the .cc files in this target. + defines = [ "SYNCABLE_PREFS_USE_POLICY" ] + deps += [ "//components/policy:policy_component_browser", "//components/policy:policy_component_common", diff --git a/components/syncable_prefs/pref_service_syncable_factory.cc b/components/syncable_prefs/pref_service_syncable_factory.cc index 88eb338..f73358f 100644 --- a/components/syncable_prefs/pref_service_syncable_factory.cc +++ b/components/syncable_prefs/pref_service_syncable_factory.cc @@ -11,7 +11,7 @@ #include "components/prefs/pref_value_store.h" #include "components/syncable_prefs/pref_service_syncable.h" -#if defined(ENABLE_CONFIGURATION_POLICY) +#if defined(SYNCABLE_PREFS_USE_POLICY) #include "components/policy/core/browser/browser_policy_connector.h" #include "components/policy/core/browser/configuration_policy_pref_store.h" #include "components/policy/core/common/policy_service.h" // nogncheck @@ -26,21 +26,27 @@ PrefServiceSyncableFactory::PrefServiceSyncableFactory() { PrefServiceSyncableFactory::~PrefServiceSyncableFactory() { } -#if defined(ENABLE_CONFIGURATION_POLICY) void PrefServiceSyncableFactory::SetManagedPolicies( policy::PolicyService* service, policy::BrowserPolicyConnector* connector) { +#if defined(SYNCABLE_PREFS_USE_POLICY) set_managed_prefs(new policy::ConfigurationPolicyPrefStore( service, connector->GetHandlerList(), policy::POLICY_LEVEL_MANDATORY)); +#else + NOTREACHED(); +#endif } void PrefServiceSyncableFactory::SetRecommendedPolicies( policy::PolicyService* service, policy::BrowserPolicyConnector* connector) { +#if defined(SYNCABLE_PREFS_USE_POLICY) set_recommended_prefs(new policy::ConfigurationPolicyPrefStore( service, connector->GetHandlerList(), policy::POLICY_LEVEL_RECOMMENDED)); -} +#else + NOTREACHED(); #endif +} void PrefServiceSyncableFactory::SetPrefModelAssociatorClient( PrefModelAssociatorClient* pref_model_associator_client) { diff --git a/components/syncable_prefs/pref_service_syncable_factory.h b/components/syncable_prefs/pref_service_syncable_factory.h index 4695317..08d79d1 100644 --- a/components/syncable_prefs/pref_service_syncable_factory.h +++ b/components/syncable_prefs/pref_service_syncable_factory.h @@ -34,13 +34,12 @@ class PrefServiceSyncableFactory : public PrefServiceFactory { PrefServiceSyncableFactory(); ~PrefServiceSyncableFactory() override; -#if defined(ENABLE_CONFIGURATION_POLICY) // Set up policy pref stores using the given policy service and connector. + // These will assert when policy is not used. void SetManagedPolicies(policy::PolicyService* service, policy::BrowserPolicyConnector* connector); void SetRecommendedPolicies(policy::PolicyService* service, policy::BrowserPolicyConnector* connector); -#endif void SetPrefModelAssociatorClient( PrefModelAssociatorClient* pref_model_associator_client); |