summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2016-03-14 23:27:04 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-15 06:28:20 +0000
commit03e6196bfe54114abdeb714f14c4d9ba66752849 (patch)
treed0ea59296b3218724d033880841abe9ca65db26b
parent9c05652c6b61b1f21c7690570939568ece26c7be (diff)
downloadchromium_src-03e6196bfe54114abdeb714f14c4d9ba66752849.zip
chromium_src-03e6196bfe54114abdeb714f14c4d9ba66752849.tar.gz
chromium_src-03e6196bfe54114abdeb714f14c4d9ba66752849.tar.bz2
Remove uses of ENABLE_CONFIGURATION_POLICY from src/chrome.
This feature is always enabled for non-iOS, and iOS doesn't use src/chrome any more. The build flag to disable the feature doesn't work because it is untested and unmtained. This is a first step to removing other uses as well. BUG=594261 Review URL: https://codereview.chromium.org/1786263002 Cr-Commit-Position: refs/heads/master@{#381185}
-rw-r--r--chrome/browser/android/signin/signin_manager_android.cc42
-rw-r--r--chrome/browser/android/signin/signin_manager_android.h4
-rw-r--r--chrome/browser/browser_process_impl.cc21
-rw-r--r--chrome/browser/browser_process_impl.h7
-rw-r--r--chrome/browser/browser_process_platform_part_base.cc5
-rw-r--r--chrome/browser/browser_process_platform_part_base.h2
-rw-r--r--chrome/browser/extensions/api/chrome_extensions_api_client.cc7
-rw-r--r--chrome/browser/extensions/api/storage/settings_apitest.cc42
-rw-r--r--chrome/browser/io_thread.cc7
-rw-r--r--chrome/browser/net/chrome_network_delegate.cc9
-rw-r--r--chrome/browser/net/chrome_network_delegate.h4
-rw-r--r--chrome/browser/policy/profile_policy_connector.h2
-rw-r--r--chrome/browser/policy/profile_policy_connector_factory.cc20
-rw-r--r--chrome/browser/prefs/browser_prefs.cc13
-rw-r--r--chrome/browser/prefs/chrome_pref_service_factory.cc9
-rw-r--r--chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc21
-rw-r--r--chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc12
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc4
-rw-r--r--chrome/browser/profiles/profile_impl.cc10
-rw-r--r--chrome/browser/profiles/profile_impl.h2
-rw-r--r--chrome/browser/profiles/profile_io_data.cc21
-rw-r--r--chrome/browser/profiles/profile_io_data.h4
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc9
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_browsertest.cc18
-rw-r--r--chrome/browser/ui/sync/one_click_signin_sync_starter.cc14
-rw-r--r--chrome/browser/ui/sync/one_click_signin_sync_starter.h5
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc9
-rw-r--r--chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc11
-rw-r--r--chrome/common/extensions/api/storage/storage_schema_manifest_handler.h2
-rw-r--r--chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc2
-rw-r--r--chrome/common/url_constants.cc4
-rw-r--r--chrome/test/base/testing_browser_process.cc26
-rw-r--r--chrome/test/base/testing_browser_process.h4
-rw-r--r--chrome/test/base/testing_profile.cc23
-rw-r--r--chrome/test/base/testing_profile.h2
35 files changed, 69 insertions, 328 deletions
diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc
index 9015d21..b5d4546 100644
--- a/chrome/browser/android/signin/signin_manager_android.cc
+++ b/chrome/browser/android/signin/signin_manager_android.cc
@@ -20,6 +20,8 @@
#include "chrome/browser/browsing_data/browsing_data_helper.h"
#include "chrome/browser/browsing_data/browsing_data_remover.h"
#include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
+#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
+#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
@@ -27,6 +29,10 @@
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "components/bookmarks/browser/bookmark_model.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
+#include "components/policy/core/common/cloud/cloud_policy_core.h"
+#include "components/policy/core/common/cloud/cloud_policy_store.h"
+#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
@@ -34,20 +40,10 @@
#include "components/signin/core/browser/signin_metrics.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "components/signin/core/common/signin_pref_names.h"
+#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_constants.h"
#include "jni/SigninManager_jni.h"
-
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
-#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
-#include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h"
-#include "components/policy/core/browser/browser_policy_connector.h"
-#include "components/policy/core/common/cloud/cloud_policy_core.h"
-#include "components/policy/core/common/cloud/cloud_policy_store.h"
-#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
-#include "google_apis/gaia/gaia_auth_util.h"
#include "net/url_request/url_request_context_getter.h"
-#endif
using bookmarks::BookmarkModel;
@@ -103,7 +99,6 @@ void SigninManagerAndroid::CheckPolicyBeforeSignIn(
JNIEnv* env,
const JavaParamRef<jobject>& obj,
const JavaParamRef<jstring>& username) {
-#if defined(ENABLE_CONFIGURATION_POLICY)
username_ = base::android::ConvertJavaStringToUTF8(env, username);
policy::UserPolicySigninService* service =
policy::UserPolicySigninServiceFactory::GetForProfile(profile_);
@@ -113,20 +108,11 @@ void SigninManagerAndroid::CheckPolicyBeforeSignIn(
.account_id,
base::Bind(&SigninManagerAndroid::OnPolicyRegisterDone,
weak_factory_.GetWeakPtr()));
-#else
- // This shouldn't be called when ShouldLoadPolicyForUser() is false.
- NOTREACHED();
- base::android::ScopedJavaLocalRef<jstring> domain;
- Java_SigninManager_onPolicyCheckedBeforeSignIn(env,
- java_signin_manager_.obj(),
- domain.obj());
-#endif
}
void SigninManagerAndroid::FetchPolicyBeforeSignIn(
JNIEnv* env,
const JavaParamRef<jobject>& obj) {
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (!dm_token_.empty()) {
policy::UserPolicySigninService* service =
policy::UserPolicySigninServiceFactory::GetForProfile(profile_);
@@ -141,7 +127,7 @@ void SigninManagerAndroid::FetchPolicyBeforeSignIn(
client_id_.clear();
return;
}
-#endif
+
// This shouldn't be called when ShouldLoadPolicyForUser() is false, or when
// CheckPolicyBeforeSignIn() failed.
NOTREACHED();
@@ -152,11 +138,9 @@ void SigninManagerAndroid::FetchPolicyBeforeSignIn(
void SigninManagerAndroid::AbortSignIn(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj) {
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::UserPolicySigninService* service =
policy::UserPolicySigninServiceFactory::GetForProfile(profile_);
service->ShutdownUserCloudPolicyManager();
-#endif
}
void SigninManagerAndroid::OnSignInCompleted(
@@ -180,7 +164,6 @@ SigninManagerAndroid::GetManagementDomain(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
base::android::ScopedJavaLocalRef<jstring> domain;
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::UserCloudPolicyManager* manager =
policy::UserCloudPolicyManagerFactory::GetForBrowserContext(profile_);
policy::CloudPolicyStore* store = manager->core()->store();
@@ -190,7 +173,6 @@ SigninManagerAndroid::GetManagementDomain(JNIEnv* env,
base::android::ConvertUTF8ToJavaString(
env, gaia::ExtractDomainName(store->policy()->username())));
}
-#endif
return domain;
}
@@ -208,8 +190,6 @@ void SigninManagerAndroid::WipeProfileData(
weak_factory_.GetWeakPtr(), java_callback));
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
-
void SigninManagerAndroid::OnPolicyRegisterDone(
const std::string& dm_token,
const std::string& client_id) {
@@ -238,8 +218,6 @@ void SigninManagerAndroid::OnPolicyFetchDone(bool success) {
java_signin_manager_.obj());
}
-#endif
-
void SigninManagerAndroid::OnBrowsingDataRemoverDone(
const base::android::ScopedJavaGlobalRef<jobject>& callback) {
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
@@ -307,13 +285,9 @@ static jboolean ShouldLoadPolicyForUser(
JNIEnv* env,
const JavaParamRef<jobject>& obj,
const JavaParamRef<jstring>& j_username) {
-#if defined(ENABLE_CONFIGURATION_POLICY)
std::string username =
base::android::ConvertJavaStringToUTF8(env, j_username);
return !policy::BrowserPolicyConnector::IsNonEnterpriseUser(username);
-#else
- return false;
-#endif
}
// static
diff --git a/chrome/browser/android/signin/signin_manager_android.h b/chrome/browser/android/signin/signin_manager_android.h
index cc0b3be..488031a 100644
--- a/chrome/browser/android/signin/signin_manager_android.h
+++ b/chrome/browser/android/signin/signin_manager_android.h
@@ -79,11 +79,9 @@ class SigninManagerAndroid {
private:
~SigninManagerAndroid();
-#if defined(ENABLE_CONFIGURATION_POLICY)
void OnPolicyRegisterDone(const std::string& dm_token,
const std::string& client_id);
void OnPolicyFetchDone(bool success);
-#endif
void OnBrowsingDataRemoverDone(
const base::android::ScopedJavaGlobalRef<jobject>& callback);
@@ -97,7 +95,6 @@ class SigninManagerAndroid {
// Java-side SigninManager object.
base::android::ScopedJavaGlobalRef<jobject> java_signin_manager_;
-#if defined(ENABLE_CONFIGURATION_POLICY)
// CloudPolicy credentials stored during a pending sign-in, awaiting user
// confirmation before starting to fetch policies.
std::string dm_token_;
@@ -106,7 +103,6 @@ class SigninManagerAndroid {
// Username that is pending sign-in. This is used to extract the domain name
// for the policy dialog, when |username_| corresponds to a managed account.
std::string username_;
-#endif
PrefChangeRegistrar pref_change_registrar_;
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 5507acd..6417c8e 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -86,6 +86,7 @@
#include "components/metrics_services_manager/metrics_services_manager.h"
#include "components/net_log/chrome_net_log.h"
#include "components/network_time/network_time_tracker.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/policy_service.h"
#include "components/prefs/json_pref_store.h"
#include "components/prefs/pref_registry_simple.h"
@@ -130,12 +131,6 @@
#include "chrome/browser/background/background_mode_manager.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "components/policy/core/browser/browser_policy_connector.h"
-#else
-#include "components/policy/core/common/policy_service_stub.h"
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
-
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/chrome_extensions_browser_client.h"
#include "chrome/browser/extensions/event_router_forwarder.h"
@@ -321,14 +316,12 @@ void BrowserProcessImpl::StartTearDown() {
message_center::MessageCenter::Shutdown();
-#if defined(ENABLE_CONFIGURATION_POLICY)
// The policy providers managed by |browser_policy_connector_| need to shut
// down while the IO and FILE threads are still alive. The monitoring
// framework owned by |browser_policy_connector_| relies on |gcm_driver_|, so
// this must be shutdown before |gcm_driver_| below.
if (browser_policy_connector_)
browser_policy_connector_->Shutdown();
-#endif
// The |gcm_driver_| must shut down while the IO thread is still alive.
if (gcm_driver_)
@@ -636,26 +629,16 @@ message_center::MessageCenter* BrowserProcessImpl::message_center() {
policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() {
DCHECK(CalledOnValidThread());
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (!created_browser_policy_connector_) {
DCHECK(!browser_policy_connector_);
browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector();
created_browser_policy_connector_ = true;
}
return browser_policy_connector_.get();
-#else
- return NULL;
-#endif
}
policy::PolicyService* BrowserProcessImpl::policy_service() {
-#if defined(ENABLE_CONFIGURATION_POLICY)
return browser_policy_connector()->GetPolicyService();
-#else
- if (!policy_service_.get())
- policy_service_.reset(new policy::PolicyServiceStub());
- return policy_service_.get();
-#endif
}
IconManager* BrowserProcessImpl::icon_manager() {
@@ -1065,7 +1048,6 @@ void BrowserProcessImpl::PreMainMessageLoopRun() {
SCOPED_UMA_HISTOGRAM_TIMER(
"Startup.BrowserProcessImpl_PreMainMessageLoopRunTime");
-#if defined(ENABLE_CONFIGURATION_POLICY)
// browser_policy_connector() is created very early because local_state()
// needs policy to be initialized with the managed preference values.
// However, policy fetches from the network and loading of disk caches
@@ -1073,7 +1055,6 @@ void BrowserProcessImpl::PreMainMessageLoopRun() {
// resume its initialization now that the loops are spinning and the
// system request context is available for the fetchers.
browser_policy_connector()->Init(local_state(), system_request_context());
-#endif
if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled))
ApplyDefaultBrowserPolicy();
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
index 3952bf0..0bba81d 100644
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -190,15 +190,8 @@ class BrowserProcessImpl : public BrowserProcess,
scoped_ptr<WatchDogThread> watchdog_thread_;
bool created_browser_policy_connector_;
-#if defined(ENABLE_CONFIGURATION_POLICY)
// Must be destroyed after |local_state_|.
scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_;
-#else
- // Must be destroyed after |local_state_|.
- // This is a stub when policy is not enabled. Otherwise, the PolicyService
- // is owned by the |browser_policy_connector_| and this is not used.
- scoped_ptr<policy::PolicyService> policy_service_;
-#endif
bool created_profile_manager_;
scoped_ptr<ProfileManager> profile_manager_;
diff --git a/chrome/browser/browser_process_platform_part_base.cc b/chrome/browser/browser_process_platform_part_base.cc
index c7b1992..fd7bee8 100644
--- a/chrome/browser/browser_process_platform_part_base.cc
+++ b/chrome/browser/browser_process_platform_part_base.cc
@@ -6,11 +6,8 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process_platform_part_base.h"
#include "chrome/browser/lifetime/application_lifetime.h"
-
-#if defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "components/policy/core/browser/browser_policy_connector.h"
-#endif
BrowserProcessPlatformPartBase::BrowserProcessPlatformPartBase() {
}
@@ -39,10 +36,8 @@ void BrowserProcessPlatformPartBase::AttemptExit() {
void BrowserProcessPlatformPartBase::PreMainMessageLoopRun() {
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
scoped_ptr<policy::BrowserPolicyConnector>
BrowserProcessPlatformPartBase::CreateBrowserPolicyConnector() {
return scoped_ptr<policy::BrowserPolicyConnector>(
new policy::ChromeBrowserPolicyConnector());
}
-#endif
diff --git a/chrome/browser/browser_process_platform_part_base.h b/chrome/browser/browser_process_platform_part_base.h
index c64ea5c..d662dbd 100644
--- a/chrome/browser/browser_process_platform_part_base.h
+++ b/chrome/browser/browser_process_platform_part_base.h
@@ -37,10 +37,8 @@ class BrowserProcessPlatformPartBase {
// Called at the end of BrowserProcessImpl::PreMainMessageLoopRun().
virtual void PreMainMessageLoopRun();
-#if defined(ENABLE_CONFIGURATION_POLICY)
virtual scoped_ptr<policy::BrowserPolicyConnector>
CreateBrowserPolicyConnector();
-#endif
private:
DISALLOW_COPY_AND_ASSIGN(BrowserProcessPlatformPartBase);
diff --git a/chrome/browser/extensions/api/chrome_extensions_api_client.cc b/chrome/browser/extensions/api/chrome_extensions_api_client.cc
index 8ef0522..3f447c2 100644
--- a/chrome/browser/extensions/api/chrome_extensions_api_client.cc
+++ b/chrome/browser/extensions/api/chrome_extensions_api_client.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h"
#include "chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.h"
#include "chrome/browser/extensions/api/management/chrome_management_api_delegate.h"
+#include "chrome/browser/extensions/api/storage/managed_value_store_cache.h"
#include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
#include "chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
@@ -29,10 +30,6 @@
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/extensions/api/storage/managed_value_store_cache.h"
-#endif
-
#if defined(OS_CHROMEOS)
#include "chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.h"
#endif
@@ -62,11 +59,9 @@ void ChromeExtensionsAPIClient::AddAdditionalValueStoreCaches(
(*caches)[settings_namespace::SYNC] =
new SyncValueStoreCache(factory, observers, context->GetPath());
-#if defined(ENABLE_CONFIGURATION_POLICY)
// Add support for chrome.storage.managed.
(*caches)[settings_namespace::MANAGED] =
new ManagedValueStoreCache(context, factory, observers);
-#endif
}
void ChromeExtensionsAPIClient::AttachWebContentsHelpers(
diff --git a/chrome/browser/extensions/api/storage/settings_apitest.cc b/chrome/browser/extensions/api/storage/settings_apitest.cc
index e909ae0..d0fb0f1 100644
--- a/chrome/browser/extensions/api/storage/settings_apitest.cc
+++ b/chrome/browser/extensions/api/storage/settings_apitest.cc
@@ -12,8 +12,19 @@
#include "chrome/browser/extensions/api/storage/settings_sync_util.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_system_factory.h"
+#include "chrome/browser/policy/schema_registry_service.h"
+#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
+#include "components/policy/core/common/mock_configuration_policy_provider.h"
+#include "components/policy/core/common/policy_bundle.h"
+#include "components/policy/core/common/policy_map.h"
+#include "components/policy/core/common/policy_namespace.h"
+#include "components/policy/core/common/policy_types.h"
+#include "components/policy/core/common/schema.h"
+#include "components/policy/core/common/schema_map.h"
+#include "components/policy/core/common/schema_registry.h"
#include "extensions/browser/api/storage/settings_namespace.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_system.h"
@@ -29,20 +40,6 @@
#include "sync/api/syncable_service.h"
#include "testing/gmock/include/gmock/gmock.h"
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/policy/schema_registry_service.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
-#include "components/policy/core/browser/browser_policy_connector.h"
-#include "components/policy/core/common/mock_configuration_policy_provider.h"
-#include "components/policy/core/common/policy_bundle.h"
-#include "components/policy/core/common/policy_map.h"
-#include "components/policy/core/common/policy_namespace.h"
-#include "components/policy/core/common/policy_types.h"
-#include "components/policy/core/common/schema.h"
-#include "components/policy/core/common/schema_map.h"
-#include "components/policy/core/common/schema_registry.h"
-#endif
-
namespace extensions {
using settings_namespace::LOCAL;
@@ -79,13 +76,11 @@ class ExtensionSettingsApiTest : public ExtensionApiTest {
void SetUpInProcessBrowserTestFixture() override {
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
-#if defined(ENABLE_CONFIGURATION_POLICY)
EXPECT_CALL(policy_provider_, IsInitializationComplete(_))
.WillRepeatedly(Return(true));
policy_provider_.SetAutoRefresh();
policy::BrowserPolicyConnector::SetPolicyProviderForTesting(
&policy_provider_);
-#endif
}
void ReplyWhenSatisfied(
@@ -132,7 +127,6 @@ class ExtensionSettingsApiTest : public ExtensionApiTest {
SendChangesToSyncableService(change_list, GetSyncableService());
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
void SetPolicies(const base::DictionaryValue& policies) {
scoped_ptr<policy::PolicyBundle> bundle(new policy::PolicyBundle());
policy::PolicyMap& policy_map = bundle->Get(policy::PolicyNamespace(
@@ -141,7 +135,6 @@ class ExtensionSettingsApiTest : public ExtensionApiTest {
policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD);
policy_provider_.UpdatePolicy(std::move(bundle));
}
-#endif
private:
const Extension* MaybeLoadAndReplyWhenSatisfied(
@@ -210,9 +203,7 @@ class ExtensionSettingsApiTest : public ExtensionApiTest {
}
protected:
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::MockConfigurationPolicyProvider policy_provider_;
-#endif
};
IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, SimpleTest) {
@@ -409,15 +400,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, IsStorageEnabled) {
EXPECT_TRUE(frontend->IsStorageEnabled(LOCAL));
EXPECT_TRUE(frontend->IsStorageEnabled(SYNC));
-#if defined(ENABLE_CONFIGURATION_POLICY)
EXPECT_TRUE(frontend->IsStorageEnabled(MANAGED));
-#else
- EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED));
-#endif
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
-
IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ExtensionsSchemas) {
// Verifies that the Schemas for the extensions domain are created on startup.
Profile* profile = browser()->profile();
@@ -575,11 +560,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest,
EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
}
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
-
IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorageDisabled) {
- // Disable the 'managed' namespace. This is redundant when
- // ENABLE_CONFIGURATION_POLICY is not defined.
+ // Disable the 'managed' namespace.
StorageFrontend* frontend = StorageFrontend::Get(browser()->profile());
frontend->DisableStorageForTesting(MANAGED);
EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED));
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index e1102549..1e1979b 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -104,11 +104,8 @@
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_job_factory_impl.h"
-#include "url/url_constants.h"
-
-#if defined(ENABLE_CONFIGURATION_POLICY)
#include "policy/policy_constants.h"
-#endif
+#include "url/url_constants.h"
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/event_router_forwarder.h"
@@ -496,7 +493,6 @@ IOThread::IOThread(
local_state);
quick_check_enabled_.MoveToThread(io_thread_proxy);
-#if defined(ENABLE_CONFIGURATION_POLICY)
is_spdy_disabled_by_policy_ = policy_service->GetPolicies(
policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())).Get(
policy::key::kDisableSpdy) != NULL;
@@ -506,7 +502,6 @@ IOThread::IOThread(
std::string())).GetValue(policy::key::kQuicAllowed);
if (value)
value->GetAsBoolean(&is_quic_allowed_by_policy_);
-#endif // ENABLE_CONFIGURATION_POLICY
BrowserThread::SetDelegate(BrowserThread::IO, this);
}
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index fa9ba6d..ee6dff8 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -42,6 +42,7 @@
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/data_usage/core/data_use_aggregator.h"
#include "components/domain_reliability/monitor.h"
+#include "components/policy/core/browser/url_blacklist_manager.h"
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
@@ -72,10 +73,6 @@
#include "chrome/common/chrome_switches.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "components/policy/core/browser/url_blacklist_manager.h"
-#endif
-
#if defined(ENABLE_EXTENSIONS)
#include "extensions/common/constants.h"
#endif
@@ -295,9 +292,7 @@ ChromeNetworkDelegate::ChromeNetworkDelegate(
enable_do_not_track_(NULL),
force_google_safe_search_(NULL),
force_youtube_safety_mode_(NULL),
-#if defined(ENABLE_CONFIGURATION_POLICY)
url_blacklist_manager_(NULL),
-#endif
domain_reliability_monitor_(NULL),
experimental_web_platform_features_enabled_(
base::CommandLine::ForCurrentProcess()
@@ -382,7 +377,6 @@ int ChromeNetworkDelegate::OnBeforeURLRequest(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest"));
-#if defined(ENABLE_CONFIGURATION_POLICY)
// TODO(joaodasilva): This prevents extensions from seeing URLs that are
// blocked. However, an extension might redirect the request to another URL,
// which is not blocked.
@@ -400,7 +394,6 @@ int ChromeNetworkDelegate::OnBeforeURLRequest(
&request->url().possibly_invalid_spec()));
return error;
}
-#endif
// TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed.
tracked_objects::ScopedTracker tracking_profile2(
diff --git a/chrome/browser/net/chrome_network_delegate.h b/chrome/browser/net/chrome_network_delegate.h
index 033c0ac..0d0f753 100644
--- a/chrome/browser/net/chrome_network_delegate.h
+++ b/chrome/browser/net/chrome_network_delegate.h
@@ -74,12 +74,10 @@ class ChromeNetworkDelegate : public net::NetworkDelegateImpl {
// Pass through to ChromeExtensionsNetworkDelegate::set_extension_info_map().
void set_extension_info_map(extensions::InfoMap* extension_info_map);
-#if defined(ENABLE_CONFIGURATION_POLICY)
void set_url_blacklist_manager(
const policy::URLBlacklistManager* url_blacklist_manager) {
url_blacklist_manager_ = url_blacklist_manager;
}
-#endif
// If |profile| is NULL or not set, events will be broadcast to all profiles,
// otherwise they will only be sent to the specified profile.
@@ -208,9 +206,7 @@ class ChromeNetworkDelegate : public net::NetworkDelegateImpl {
BooleanPrefMember* force_youtube_safety_mode_;
// Weak, owned by our owner.
-#if defined(ENABLE_CONFIGURATION_POLICY)
const policy::URLBlacklistManager* url_blacklist_manager_;
-#endif
domain_reliability::DomainReliabilityMonitor* domain_reliability_monitor_;
// When true, allow access to all file:// URLs.
diff --git a/chrome/browser/policy/profile_policy_connector.h b/chrome/browser/policy/profile_policy_connector.h
index 86dedcf..d6e4fe79 100644
--- a/chrome/browser/policy/profile_policy_connector.h
+++ b/chrome/browser/policy/profile_policy_connector.h
@@ -67,7 +67,6 @@ class ProfilePolicyConnector : public KeyedService {
const ConfigurationPolicyProvider* DeterminePolicyProviderForPolicy(
const char* name) const;
-#if defined(ENABLE_CONFIGURATION_POLICY)
#if defined(OS_CHROMEOS)
// Some of the user policy configuration affects browser global state, and
// can only come from one Profile. |is_primary_user_| is true if this
@@ -81,7 +80,6 @@ class ProfilePolicyConnector : public KeyedService {
scoped_ptr<ConfigurationPolicyProvider> wrapped_platform_policy_provider_;
CloudPolicyManager* user_cloud_policy_manager_;
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
// |policy_providers_| contains a list of the policy providers available for
// the PolicyService of this connector, in decreasing order of priority.
diff --git a/chrome/browser/policy/profile_policy_connector_factory.cc b/chrome/browser/policy/profile_policy_connector_factory.cc
index 11a591e..1bf9210 100644
--- a/chrome/browser/policy/profile_policy_connector_factory.cc
+++ b/chrome/browser/policy/profile_policy_connector_factory.cc
@@ -10,25 +10,23 @@
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "chrome/browser/policy/profile_policy_connector.h"
+#include "chrome/browser/policy/schema_registry_service.h"
+#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/policy/core/common/policy_service.h"
-
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/policy/schema_registry_service.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "components/policy/core/common/policy_service_impl.h"
+
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "components/user_manager/user.h"
-#else
+#else // Non-ChromeOS.
#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#endif
-#endif
namespace policy {
@@ -60,25 +58,21 @@ void ProfilePolicyConnectorFactory::SetServiceForTesting(
map_entry = connector;
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
void ProfilePolicyConnectorFactory::PushProviderForTesting(
ConfigurationPolicyProvider* provider) {
test_providers_.push_back(provider);
}
-#endif
ProfilePolicyConnectorFactory::ProfilePolicyConnectorFactory()
: BrowserContextKeyedBaseFactory(
"ProfilePolicyConnector",
BrowserContextDependencyManager::GetInstance()) {
-#if defined(ENABLE_CONFIGURATION_POLICY)
DependsOn(SchemaRegistryServiceFactory::GetInstance());
#if defined(OS_CHROMEOS)
DependsOn(UserCloudPolicyManagerFactoryChromeOS::GetInstance());
#else
DependsOn(UserCloudPolicyManagerFactory::GetInstance());
#endif
-#endif
}
ProfilePolicyConnectorFactory::~ProfilePolicyConnectorFactory() {
@@ -103,7 +97,6 @@ ProfilePolicyConnectorFactory::CreateForBrowserContextInternal(
bool force_immediate_load) {
DCHECK(connectors_.find(context) == connectors_.end());
-#if defined(ENABLE_CONFIGURATION_POLICY)
SchemaRegistry* schema_registry = nullptr;
CloudPolicyManager* user_cloud_policy_manager = nullptr;
@@ -123,11 +116,9 @@ ProfilePolicyConnectorFactory::CreateForBrowserContextInternal(
user_cloud_policy_manager =
UserCloudPolicyManagerFactory::GetForBrowserContext(context);
#endif // defined(OS_CHROMEOS)
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
scoped_ptr<ProfilePolicyConnector> connector(new ProfilePolicyConnector());
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (test_providers_.empty()) {
connector->Init(
#if defined(OS_CHROMEOS)
@@ -141,9 +132,6 @@ ProfilePolicyConnectorFactory::CreateForBrowserContextInternal(
scoped_ptr<PolicyService> service(new PolicyServiceImpl(providers));
connector->InitForTesting(std::move(service));
}
-#else
- connector->Init(nullptr, nullptr);
-#endif
connectors_[context] = connector.get();
return connector;
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index d4fd972..8535069 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -77,6 +77,9 @@
#include "components/omnibox/browser/zero_suggest_provider.h"
#include "components/password_manager/core/browser/password_bubble_experiment.h"
#include "components/password_manager/core/browser/password_manager.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
+#include "components/policy/core/browser/url_blacklist_manager.h"
+#include "components/policy/core/common/policy_statistics_collector.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
@@ -101,12 +104,6 @@
#include "chrome/browser/background/background_mode_manager.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "components/policy/core/browser/browser_policy_connector.h"
-#include "components/policy/core/browser/url_blacklist_manager.h"
-#include "components/policy/core/common/policy_statistics_collector.h"
-#endif
-
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/apps/drive/drive_app_mapping.h"
@@ -311,10 +308,8 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
autofill::AutofillDialogController::RegisterPrefs(registry);
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::BrowserPolicyConnector::RegisterPrefs(registry);
policy::PolicyStatisticsCollector::RegisterPrefs(registry);
-#endif
#if defined(ENABLE_EXTENSIONS)
EasyUnlockService::RegisterPrefs(registry);
@@ -449,9 +444,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
autofill::AutofillDialogController::RegisterProfilePrefs(registry);
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::URLBlacklistManager::RegisterProfilePrefs(registry);
-#endif
#if defined(ENABLE_EXTENSIONS)
EasyUnlockService::RegisterProfilePrefs(registry);
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index 2472dee..4e3874e 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -31,6 +31,8 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/component_updater/pref_names.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
+#include "components/policy/core/browser/configuration_policy_pref_store.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/default_pref_store.h"
#include "components/prefs/json_pref_store.h"
@@ -56,11 +58,6 @@
#include "sync/internal_api/public/base/model_type.h"
#include "ui/base/resource/resource_bundle.h"
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "components/policy/core/browser/browser_policy_connector.h"
-#include "components/policy/core/browser/configuration_policy_pref_store.h"
-#endif
-
#if defined(ENABLE_EXTENSIONS)
#include "extensions/browser/pref_names.h"
#endif
@@ -426,12 +423,10 @@ void PrepareFactory(
scoped_refptr<PersistentPrefStore> user_pref_store,
const scoped_refptr<PrefStore>& extension_prefs,
bool async) {
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::BrowserPolicyConnector* policy_connector =
g_browser_process->browser_policy_connector();
factory->SetManagedPolicies(policy_service, policy_connector);
factory->SetRecommendedPolicies(policy_service, policy_connector);
-#endif // ENABLE_CONFIGURATION_POLICY
#if defined(ENABLE_SUPERVISED_USERS)
if (supervised_user_settings) {
diff --git a/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc b/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc
index 3c44310..b467183 100644
--- a/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc
+++ b/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc
@@ -13,9 +13,14 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_profile.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
+#include "components/policy/core/common/mock_configuration_policy_provider.h"
+#include "components/policy/core/common/policy_map.h"
+#include "components/policy/core/common/policy_types.h"
#include "components/syncable_prefs/synced_pref_change_registrar.h"
#include "components/syncable_prefs/testing_pref_service_syncable.h"
#include "content/public/test/test_utils.h"
+#include "policy/policy_constants.h"
#include "sync/api/attachments/attachment_id.h"
#include "sync/api/fake_sync_change_processor.h"
#include "sync/api/sync_change.h"
@@ -25,14 +30,6 @@
#include "sync/internal_api/public/attachments/attachment_service_proxy_for_test.h"
#include "sync/protocol/sync.pb.h"
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "components/policy/core/browser/browser_policy_connector.h"
-#include "components/policy/core/common/mock_configuration_policy_provider.h"
-#include "components/policy/core/common/policy_map.h"
-#include "components/policy/core/common/policy_types.h"
-#include "policy/policy_constants.h"
-#endif
-
namespace {
using testing::Return;
@@ -43,14 +40,12 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest {
SyncedPrefChangeRegistrarTest() : next_sync_data_id_(0) {}
~SyncedPrefChangeRegistrarTest() override {}
-#if defined(ENABLE_CONFIGURATION_POLICY)
void UpdateChromePolicy(const policy::PolicyMap& policies) {
policy_provider_.UpdateChromePolicy(policies);
DCHECK(base::MessageLoop::current());
base::RunLoop loop;
loop.RunUntilIdle();
}
-#endif
void SetBooleanPrefValueFromSync(const std::string& name, bool value) {
std::string serialized_value;
@@ -95,14 +90,12 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest {
}
private:
-#if defined(ENABLE_CONFIGURATION_POLICY)
void SetUpInProcessBrowserTestFixture() override {
EXPECT_CALL(policy_provider_, IsInitializationComplete(_))
.WillRepeatedly(Return(true));
policy::BrowserPolicyConnector::SetPolicyProviderForTesting(
&policy_provider_);
}
-#endif
void SetUpOnMainThread() override {
prefs_ = PrefServiceSyncableFromProfile(browser()->profile());
@@ -123,9 +116,7 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest {
int next_sync_data_id_;
scoped_ptr<syncable_prefs::SyncedPrefChangeRegistrar> registrar_;
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::MockConfigurationPolicyProvider policy_provider_;
-#endif
};
struct TestSyncedPrefObserver {
@@ -181,7 +172,6 @@ IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest,
EXPECT_FALSE(observer.last_seen_value);
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest,
IgnoreLocalChangesToManagedPrefs) {
TestSyncedPrefObserver observer = {};
@@ -224,4 +214,3 @@ IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest,
EXPECT_FALSE(observer.has_been_notified);
EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton));
}
-#endif
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
index ac0cd42..03ad4ca 100644
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -35,7 +35,10 @@
#include "chrome/browser/password_manager/password_manager_setting_migrator_service_factory.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/plugins/plugin_prefs_factory.h"
+#include "chrome/browser/policy/cloud/policy_header_service_factory.h"
+#include "chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
+#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/predictors/autocomplete_action_predictor_factory.h"
#include "chrome/browser/predictors/predictor_database_factory.h"
#include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
@@ -84,10 +87,6 @@
#include "chrome/browser/captive_portal/captive_portal_service_factory.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/policy/cloud/policy_header_service_factory.h"
-#include "chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
#include "chrome/browser/chromeos/policy/consumer_enrollment_handler_factory.h"
@@ -101,7 +100,6 @@
#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
#endif
-#endif
#if defined(ENABLE_SUPERVISED_USERS)
#include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_factory.h"
@@ -284,7 +282,6 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
#endif
PrefsTabHelper::GetServiceInstance();
policy::ProfilePolicyConnectorFactory::GetInstance();
-#if defined(ENABLE_CONFIGURATION_POLICY)
#if defined(OS_CHROMEOS)
chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance();
policy::ConsumerEnrollmentHandlerFactory::GetInstance();
@@ -294,14 +291,13 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
policy::UserCloudPolicyManagerFactoryChromeOS::GetInstance();
policy::UserCloudPolicyTokenForwarderFactory::GetInstance();
policy::UserNetworkConfigurationUpdaterFactory::GetInstance();
-#else
+#else // !defined(OS_CHROMEOS)
policy::UserCloudPolicyManagerFactory::GetInstance();
policy::UserPolicySigninServiceFactory::GetInstance();
#endif
policy::PolicyHeaderServiceFactory::GetInstance();
policy::SchemaRegistryServiceFactory::GetInstance();
policy::UserCloudPolicyInvalidatorFactory::GetInstance();
-#endif
predictors::AutocompleteActionPredictorFactory::GetInstance();
predictors::PredictorDatabaseFactory::GetInstance();
predictors::ResourcePrefetchPredictorFactory::GetInstance();
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index 0a567f1..37a0ccc 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -73,7 +73,7 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS)
+#if !defined(OS_CHROMEOS)
#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
#endif
@@ -131,7 +131,7 @@ void OffTheRecordProfileImpl::Init() {
// we have to instantiate OffTheRecordProfileIOData::Handle here after a ctor.
InitIoData();
-#if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS)
+#if !defined(OS_CHROMEOS)
// Because UserCloudPolicyManager is in a component, it cannot access
// GetOriginalProfile. Instead, we have to inject this relation here.
policy::UserCloudPolicyManagerFactory::RegisterForOffTheRecordBrowserContext(
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index fc5c3f6..8adabb9 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -51,6 +51,8 @@
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
+#include "chrome/browser/policy/schema_registry_service.h"
+#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/chrome_pref_service_factory.h"
#include "chrome/browser/prefs/pref_service_syncable_util.h"
@@ -87,6 +89,7 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/metrics/metrics_service.h"
#include "components/omnibox/browser/autocomplete_classifier.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/json_pref_store.h"
#include "components/prefs/scoped_user_pref_update.h"
@@ -126,10 +129,6 @@
#include "chrome/browser/background/background_mode_manager.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/policy/schema_registry_service.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
-#include "components/policy/core/browser/browser_policy_connector.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/session/user_session_manager.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
@@ -138,7 +137,6 @@
#include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#endif
-#endif
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_service.h"
@@ -407,7 +405,6 @@ ProfileImpl::ProfileImpl(
// If we are creating the profile synchronously, then we should load the
// policy data immediately.
bool force_immediate_policy_load = (create_mode == CREATE_MODE_SYNCHRONOUS);
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::BrowserPolicyConnector* connector =
g_browser_process->browser_policy_connector();
schema_registry_service_ =
@@ -426,7 +423,6 @@ ProfileImpl::ProfileImpl(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
#endif
-#endif
profile_policy_connector_ =
policy::ProfilePolicyConnectorFactory::CreateForBrowserContext(
this, force_immediate_policy_load);
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index 612a48d..0068078 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -213,10 +213,8 @@ class ProfileImpl : public Profile {
// This can be removed once |prefs_| becomes a KeyedService too.
// |profile_policy_connector_| in turn depends on |cloud_policy_manager_|,
// which depends on |schema_registry_service_|.
-#if defined(ENABLE_CONFIGURATION_POLICY)
scoped_ptr<policy::SchemaRegistryService> schema_registry_service_;
scoped_ptr<policy::CloudPolicyManager> cloud_policy_manager_;
-#endif
scoped_ptr<policy::ProfilePolicyConnector> profile_policy_connector_;
// Keep |pref_validation_delegate_| above |prefs_| so that the former outlives
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index aaea4da..c4e0cd9 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -41,6 +41,8 @@
#include "chrome/browser/net/chrome_url_request_context_getter.h"
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/browser/net/resource_prefetch_predictor_observer.h"
+#include "chrome/browser/policy/cloud/policy_header_service_factory.h"
+#include "chrome/browser/policy/policy_helpers.h"
#include "chrome/browser/predictors/resource_prefetch_predictor.h"
#include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -62,6 +64,10 @@
#include "components/dom_distiller/core/url_constants.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/net_log/chrome_net_log.h"
+#include "components/policy/core/browser/url_blacklist_manager.h"
+#include "components/policy/core/common/cloud/policy_header_io_helper.h"
+#include "components/policy/core/common/cloud/policy_header_service.h"
+#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#include "components/prefs/pref_service.h"
#include "components/signin/core/common/signin_pref_names.h"
#include "components/sync_driver/pref_names.h"
@@ -96,15 +102,6 @@
#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job_factory_impl.h"
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/policy/cloud/policy_header_service_factory.h"
-#include "chrome/browser/policy/policy_helpers.h"
-#include "components/policy/core/browser/url_blacklist_manager.h"
-#include "components/policy/core/common/cloud/policy_header_io_helper.h"
-#include "components/policy/core/common/cloud/policy_header_service.h"
-#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
-#endif
-
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_cookie_monster_delegate.h"
#include "chrome/browser/extensions/extension_resource_protocols.h"
@@ -518,7 +515,6 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
// ShutdownOnUIThread to release these observers on the right thread.
// Don't pass it in |profile_params_| to make sure it is correctly cleaned up,
// in particular when this ProfileIOData isn't |initialized_| during deletion.
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::URLBlacklist::SegmentURLCallback callback =
static_cast<policy::URLBlacklist::SegmentURLCallback>(
url_formatter::SegmentURL);
@@ -538,7 +534,6 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner);
}
}
-#endif
incognito_availibility_pref_.Init(
prefs::kIncognitoModeAvailability, pref_service);
@@ -1038,9 +1033,7 @@ void ProfileIOData::Init(
}
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get());
-#endif
network_delegate->set_profile(profile_params_->profile);
network_delegate->set_profile_path(profile_params_->path);
network_delegate->set_cookie_settings(profile_params_->cookie_settings.get());
@@ -1260,10 +1253,8 @@ void ProfileIOData::ShutdownOnUIThread(
if (media_device_id_salt_.get())
media_device_id_salt_->ShutdownOnUIThread();
session_startup_pref_.Destroy();
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (url_blacklist_manager_)
url_blacklist_manager_->ShutdownOnUIThread();
-#endif
if (chrome_http_user_agent_settings_)
chrome_http_user_agent_settings_->CleanupOnUIThread();
incognito_availibility_pref_.Destroy();
diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h
index 92c9bf5..15166f2 100644
--- a/chrome/browser/profiles/profile_io_data.h
+++ b/chrome/browser/profiles/profile_io_data.h
@@ -213,11 +213,9 @@ class ProfileIOData {
return resource_prefetch_predictor_observer_.get();
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::PolicyHeaderIOHelper* policy_header_helper() const {
return policy_header_helper_.get();
}
-#endif
#if defined(ENABLE_SUPERVISED_USERS)
const SupervisedUserURLFilter* supervised_user_url_filter() const {
@@ -528,11 +526,9 @@ class ProfileIOData {
BooleanPrefMember enable_metrics_;
-#if defined(ENABLE_CONFIGURATION_POLICY)
// Pointed to by NetworkDelegate.
mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_;
mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_;
-#endif
// Pointed to by URLRequestContext.
#if defined(ENABLE_EXTENSIONS)
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index 2f2f4df..4707ffa 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -40,6 +40,7 @@
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
#include "components/google/core/browser/google_util.h"
+#include "components/policy/core/common/cloud/policy_header_io_helper.h"
#include "components/variations/net/variations_http_headers.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
@@ -64,10 +65,6 @@
#include "chrome/browser/component_updater/pnacl_component_installer.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "components/policy/core/common/cloud/policy_header_io_helper.h"
-#endif
-
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/apps/app_url_redirector.h"
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
@@ -365,10 +362,8 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
request->SetExtraRequestHeaders(headers);
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (io_data->policy_header_helper())
io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request);
-#endif
signin::AppendMirrorRequestHeaderHelper(request, GURL() /* redirect_url */,
io_data, info->GetChildID(),
@@ -685,10 +680,8 @@ void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
redirect_url, request);
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (io_data->policy_header_helper())
io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request);
-#endif
}
// Notification that a request has completed.
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index f2e3071..63fc89b 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -52,7 +52,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
-#if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS)
+#if !defined(OS_CHROMEOS)
#include "base/callback.h"
#include "base/run_loop.h"
#include "base/values.h"
@@ -66,7 +66,7 @@
using testing::_;
using testing::Return;
-#endif // defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS)
+#endif // !defined(OS_CHROMEOS)
#if defined(ENABLE_SUPERVISED_USERS)
#include "chrome/browser/supervised_user/supervised_user_navigation_observer.h"
@@ -1250,11 +1250,6 @@ IN_PROC_BROWSER_TEST_F(SupervisedUserBrowserCreatorTest,
// the sync promo exist there.
#if !defined(OS_CHROMEOS)
-// On a branded Linux build, policy is required to suppress the first-run
-// dialog.
-#if !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || \
- defined(ENABLE_CONFIGURATION_POLICY)
-
class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest {
protected:
void SetUpCommandLine(base::CommandLine* command_line) override;
@@ -1265,10 +1260,8 @@ class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest {
return !IsWindows10OrNewer();
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::MockConfigurationPolicyProvider provider_;
policy::PolicyMap policy_map_;
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
};
void StartupBrowserCreatorFirstRunTest::SetUpCommandLine(
@@ -1277,7 +1270,6 @@ void StartupBrowserCreatorFirstRunTest::SetUpCommandLine(
}
void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() {
-#if defined(ENABLE_CONFIGURATION_POLICY)
#if defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD)
// Set a policy that prevents the first-run dialog from being shown.
policy_map_.Set(policy::key::kMetricsReportingEnabled,
@@ -1292,7 +1284,6 @@ void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() {
EXPECT_CALL(provider_, IsInitializationComplete(_))
.WillRepeatedly(Return(true));
policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
}
#if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
@@ -1618,7 +1609,6 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
#if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
// http://crbug.com/314819
#define MAYBE_RestoreOnStartupURLsPolicySpecified \
@@ -1679,9 +1669,5 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
EXPECT_EQ("title1.html",
tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
}
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
-
-#endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
- // defined(ENABLE_CONFIGURATION_POLICY)
#endif // !defined(OS_CHROMEOS)
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
index b01c15f..6e50099 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -9,13 +9,8 @@
#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
-#include "components/prefs/pref_service.h"
-
-#if defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/policy/cloud/user_policy_signin_service.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
-#endif
-
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
@@ -39,6 +34,7 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/browser_sync/browser/profile_sync_service.h"
+#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/browser/signin_metrics.h"
#include "components/signin/core/common/profile_management_switches.h"
@@ -150,7 +146,6 @@ void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) {
// If this is a new signin (no account authenticated yet) try loading
// policy for this user now, before any signed in services are initialized.
if (!signin->IsAuthenticated()) {
-#if defined(ENABLE_CONFIGURATION_POLICY)
policy::UserPolicySigninService* policy_service =
policy::UserPolicySigninServiceFactory::GetForProfile(profile_);
policy_service->RegisterForPolicy(
@@ -159,9 +154,6 @@ void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) {
base::Bind(&OneClickSigninSyncStarter::OnRegisteredForPolicy,
weak_pointer_factory_.GetWeakPtr()));
return;
-#else
- ConfirmAndSignin();
-#endif
} else {
// The user is already signed in - just tell SigninManager to continue
// with its re-auth flow.
@@ -169,10 +161,9 @@ void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) {
}
}
-#if defined(ENABLE_CONFIGURATION_POLICY)
OneClickSigninSyncStarter::SigninDialogDelegate::SigninDialogDelegate(
base::WeakPtr<OneClickSigninSyncStarter> sync_starter)
- : sync_starter_(sync_starter) {
+ : sync_starter_(sync_starter) {
}
OneClickSigninSyncStarter::SigninDialogDelegate::~SigninDialogDelegate() {
@@ -345,7 +336,6 @@ void OneClickSigninSyncStarter::CompleteInitForNewProfile(
}
}
}
-#endif
void OneClickSigninSyncStarter::CancelSigninAndDelete() {
SigninManagerFactory::GetForProfile(profile_)
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.h b/chrome/browser/ui/sync/one_click_signin_sync_starter.h
index 515132e..5cc3369 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.h
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.h
@@ -134,7 +134,6 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer,
void OnSyncConfirmationUIClosed(
LoginUIService::SyncConfirmationUIClosedResults results) override;
-#if defined(ENABLE_CONFIGURATION_POLICY)
// User input handler for the signin confirmation dialog.
class SigninDialogDelegate
: public ui::ProfileSigninConfirmationDelegate {
@@ -173,8 +172,6 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer,
void CompleteInitForNewProfile(Profile* profile,
Profile::CreateStatus status);
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
-
// Cancels the in-progress signin for this profile.
void CancelSigninAndDelete();
@@ -231,12 +228,10 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer,
// Callback executed when sync setup succeeds or fails.
Callback sync_setup_completed_callback_;
-#if defined(ENABLE_CONFIGURATION_POLICY)
// Policy credentials we keep while determining whether to create
// a new profile for an enterprise user or not.
std::string dm_token_;
std::string client_id_;
-#endif
base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_;
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index e160167..9900da0 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -42,6 +42,8 @@
#include "chrome/browser/ui/webui/options/options_ui.h"
#include "chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.h"
#include "chrome/browser/ui/webui/plugins/plugins_ui.h"
+#include "chrome/browser/ui/webui/policy_material_design_ui.h"
+#include "chrome/browser/ui/webui/policy_ui.h"
#include "chrome/browser/ui/webui/predictors/predictors_ui.h"
#include "chrome/browser/ui/webui/profiler_ui.h"
#include "chrome/browser/ui/webui/settings/md_settings_ui.h"
@@ -79,11 +81,6 @@
#include "chrome/browser/ui/webui/nacl_ui.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/ui/webui/policy_material_design_ui.h"
-#include "chrome/browser/ui/webui/policy_ui.h"
-#endif
-
#if defined(ENABLE_WEBRTC)
#include "chrome/browser/ui/webui/media/webrtc_logs_ui.h"
#endif
@@ -531,14 +528,12 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
#endif
#endif // (USE_NSS_CERTS || USE_OPENSSL_CERTS) && USE_AURA
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (url.host() == chrome::kChromeUIPolicyHost)
return &NewWebUI<PolicyUI>;
if (url.host() == chrome::kChromeUIMdPolicyHost &&
switches::MdPolicyPageEnabled()) {
return &NewWebUI<PolicyMaterialDesignUI>;
}
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
#if defined(ENABLE_APP_LIST)
if (url.host() == chrome::kChromeUIAppListStartPageHost)
diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
index a8a7588..9cac6f7 100644
--- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
+++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
@@ -13,6 +13,7 @@
#include "base/strings/string16.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "components/policy/core/common/schema.h"
#include "extensions/common/extension.h"
#include "extensions/common/install_warning.h"
#include "extensions/common/manifest.h"
@@ -22,10 +23,6 @@
#include "extensions/common/permissions/api_permission_set.h"
#include "extensions/common/permissions/permissions_info.h"
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "components/policy/core/common/schema.h"
-#endif
-
using extensions::manifest_keys::kStorageManagedSchema;
namespace extensions {
@@ -34,7 +31,6 @@ StorageSchemaManifestHandler::StorageSchemaManifestHandler() {}
StorageSchemaManifestHandler::~StorageSchemaManifestHandler() {}
-#if defined(ENABLE_CONFIGURATION_POLICY)
// static
policy::Schema StorageSchemaManifestHandler::GetSchema(
const Extension* extension,
@@ -60,7 +56,6 @@ policy::Schema StorageSchemaManifestHandler::GetSchema(
}
return policy::Schema::Parse(content, error);
}
-#endif
bool StorageSchemaManifestHandler::Parse(Extension* extension,
base::string16* error) {
@@ -82,11 +77,7 @@ bool StorageSchemaManifestHandler::Validate(
const Extension* extension,
std::string* error,
std::vector<InstallWarning>* warnings) const {
-#if defined(ENABLE_CONFIGURATION_POLICY)
return GetSchema(extension, error).valid();
-#else
- return true;
-#endif
}
const std::vector<std::string> StorageSchemaManifestHandler::Keys() const {
diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.h b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.h
index ef130b3..946b6cb 100644
--- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.h
+++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.h
@@ -20,14 +20,12 @@ class StorageSchemaManifestHandler : public ManifestHandler {
StorageSchemaManifestHandler();
~StorageSchemaManifestHandler() override;
-#if defined(ENABLE_CONFIGURATION_POLICY)
// Returns the managed storage schema defined for |extension|.
// If the schema is invalid then the Schema returned is invalid too, and
// the failure reason is stored in |error|.
// This function does file I/O and must be called on a thread that allows I/O.
static policy::Schema GetSchema(const Extension* extension,
std::string* error);
-#endif
private:
// ManifestHandler implementation:
diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc b/chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc
index 6b07ed9..869e2b7 100644
--- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc
+++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc
@@ -90,7 +90,6 @@ TEST_F(StorageSchemaManifestHandlerTest, Validate) {
permissions.AppendString("storage");
manifest_.Set("permissions", permissions.DeepCopy());
-#if defined(ENABLE_CONFIGURATION_POLICY)
// Absolute path.
manifest_.SetString("storage.managed_schema", "/etc/passwd");
EXPECT_FALSE(Validates(""));
@@ -136,7 +135,6 @@ TEST_F(StorageSchemaManifestHandlerTest, Validate) {
" \"type\": \"object\","
" \"additionalProperties\": {}"
"}"));
-#endif
// All good now.
EXPECT_TRUE(Validates(
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index d850d67..3f42e05 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -616,6 +616,7 @@ const char* const kChromeHostURLs[] = {
kChromeUINewTabHost,
kChromeUIOmniboxHost,
kChromeUIPasswordManagerInternalsHost,
+ kChromeUIPolicyHost,
kChromeUIPredictorsHost,
kChromeUIProfilerHost,
kChromeUISignInInternalsHost,
@@ -687,9 +688,6 @@ const char* const kChromeHostURLs[] = {
#if !defined(DISABLE_NACL)
kChromeUINaClHost,
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
- kChromeUIPolicyHost,
-#endif
#if defined(ENABLE_EXTENSIONS)
kChromeUIExtensionsHost,
#endif
diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc
index 404e3f3..4f2cd47 100644
--- a/chrome/test/base/testing_browser_process.cc
+++ b/chrome/test/base/testing_browser_process.cc
@@ -17,23 +17,17 @@
#include "chrome/common/features.h"
#include "chrome/test/base/testing_browser_process_platform_part.h"
#include "components/network_time/network_time_tracker.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/notification_service.h"
#include "net/url_request/url_request_context_getter.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/message_center/message_center.h"
-
#if BUILDFLAG(ENABLE_BACKGROUND)
#include "chrome/browser/background/background_mode_manager.h"
#endif
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "components/policy/core/browser/browser_policy_connector.h"
-#else
-#include "components/policy/core/common/policy_service_stub.h"
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
-
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/chrome_extensions_browser_client.h"
#include "chrome/browser/media_galleries/media_file_system_registry.h"
@@ -85,9 +79,7 @@ TestingBrowserProcess::TestingBrowserProcess()
TestingBrowserProcess::~TestingBrowserProcess() {
EXPECT_FALSE(local_state_);
-#if defined(ENABLE_CONFIGURATION_POLICY)
ShutdownBrowserPolicyConnector();
-#endif
#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionsBrowserClient::Set(nullptr);
#endif
@@ -154,26 +146,16 @@ TestingBrowserProcess::promo_resource_service() {
policy::BrowserPolicyConnector*
TestingBrowserProcess::browser_policy_connector() {
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (!browser_policy_connector_) {
EXPECT_FALSE(created_browser_policy_connector_);
created_browser_policy_connector_ = true;
browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector();
}
return browser_policy_connector_.get();
-#else
- return nullptr;
-#endif
}
policy::PolicyService* TestingBrowserProcess::policy_service() {
-#if defined(ENABLE_CONFIGURATION_POLICY)
return browser_policy_connector()->GetPolicyService();
-#else
- if (!policy_service_)
- policy_service_.reset(new policy::PolicyServiceStub());
- return policy_service_.get();
-#endif
}
IconManager* TestingBrowserProcess::icon_manager() {
@@ -411,10 +393,8 @@ void TestingBrowserProcess::SetLocalState(PrefService* local_state) {
// are also freed.
network_time_tracker_.reset();
notification_ui_manager_.reset();
-#if defined(ENABLE_CONFIGURATION_POLICY)
ShutdownBrowserPolicyConnector();
created_browser_policy_connector_ = false;
-#endif
}
local_state_ = local_state;
}
@@ -424,13 +404,9 @@ void TestingBrowserProcess::SetIOThread(IOThread* io_thread) {
}
void TestingBrowserProcess::ShutdownBrowserPolicyConnector() {
-#if defined(ENABLE_CONFIGURATION_POLICY)
if (browser_policy_connector_)
browser_policy_connector_->Shutdown();
browser_policy_connector_.reset();
-#else
- CHECK(false);
-#endif
}
void TestingBrowserProcess::SetSafeBrowsingService(
diff --git a/chrome/test/base/testing_browser_process.h b/chrome/test/base/testing_browser_process.h
index 5c1f2b9..fbb8983 100644
--- a/chrome/test/base/testing_browser_process.h
+++ b/chrome/test/base/testing_browser_process.h
@@ -152,12 +152,8 @@ class TestingBrowserProcess : public BrowserProcess {
unsigned int module_ref_count_;
std::string app_locale_;
-#if defined(ENABLE_CONFIGURATION_POLICY)
scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_;
bool created_browser_policy_connector_ = false;
-#else
- scoped_ptr<policy::PolicyService> policy_service_;
-#endif
scoped_ptr<ProfileManager> profile_manager_;
scoped_ptr<NotificationUIManager> notification_ui_manager_;
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 9c64443..8edc7dc 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -33,6 +33,8 @@
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
+#include "chrome/browser/policy/schema_registry_service.h"
+#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/pref_service_syncable_util.h"
#include "chrome/browser/prerender/prerender_manager.h"
@@ -66,7 +68,10 @@
#include "components/omnibox/browser/autocomplete_classifier.h"
#include "components/omnibox/browser/history_index_restore_observer.h"
#include "components/omnibox/browser/in_memory_url_index.h"
+#include "components/policy/core/common/configuration_policy_provider.h"
#include "components/policy/core/common/policy_service.h"
+#include "components/policy/core/common/policy_service_impl.h"
+#include "components/policy/core/common/schema.h"
#include "components/prefs/testing_pref_store.h"
#include "components/proxy_config/pref_proxy_config_tracker.h"
#include "components/syncable_prefs/pref_service_syncable.h"
@@ -89,16 +94,6 @@
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
-#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/policy/schema_registry_service.h"
-#include "chrome/browser/policy/schema_registry_service_factory.h"
-#include "components/policy/core/common/configuration_policy_provider.h"
-#include "components/policy/core/common/policy_service_impl.h"
-#include "components/policy/core/common/schema.h"
-#else
-#include "components/policy/core/common/policy_service_stub.h"
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
-
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_special_storage_policy.h"
@@ -763,21 +758,15 @@ void TestingProfile::CreateIncognitoPrefService() {
}
void TestingProfile::CreateProfilePolicyConnector() {
-#if defined(ENABLE_CONFIGURATION_POLICY)
schema_registry_service_ =
policy::SchemaRegistryServiceFactory::CreateForContext(
this, policy::Schema(), NULL);
CHECK_EQ(schema_registry_service_.get(),
policy::SchemaRegistryServiceFactory::GetForContext(this));
-#endif // defined(ENABLE_CONFIGURATION_POLICY)
-if (!policy_service_) {
-#if defined(ENABLE_CONFIGURATION_POLICY)
+ if (!policy_service_) {
std::vector<policy::ConfigurationPolicyProvider*> providers;
policy_service_.reset(new policy::PolicyServiceImpl(providers));
-#else
- policy_service_.reset(new policy::PolicyServiceStub());
-#endif
}
profile_policy_connector_.reset(new policy::ProfilePolicyConnector());
profile_policy_connector_->InitForTesting(std::move(policy_service_));
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index 7004078..8dc5b05 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -407,9 +407,7 @@ class TestingProfile : public Profile {
// scoped_ptr<>.
content::MockResourceContext* resource_context_;
-#if defined(ENABLE_CONFIGURATION_POLICY)
scoped_ptr<policy::SchemaRegistryService> schema_registry_service_;
-#endif
scoped_ptr<policy::ProfilePolicyConnector> profile_policy_connector_;
// Weak pointer to a delegate for indicating that a profile was created.