summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/common.gypi3
-rw-r--r--chrome/browser/browser_process_impl.cc2
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store.cc30
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store.h5
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store_unittest.cc38
-rw-r--r--chrome/browser/policy/policy_stubs.cc75
-rw-r--r--chrome/browser/prefs/browser_prefs.cc2
-rw-r--r--chrome/browser/prefs/pref_service.cc16
-rw-r--r--chrome/browser/prefs/pref_service_mock_builder.cc12
-rw-r--r--chrome/browser/prefs/pref_service_mock_builder.h2
-rw-r--r--chrome/browser/ui/webui/options/advanced_options_handler.cc8
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc8
-rw-r--r--chrome/browser/ui/webui/options/options_managed_banner_handler.cc6
-rw-r--r--chrome/browser/ui/webui/options/options_managed_banner_handler.h10
-rw-r--r--chrome/browser/ui/webui/options/options_managed_banner_handler_stub.cc11
-rw-r--r--chrome/browser/ui/webui/options/personal_options_handler.cc8
-rw-r--r--chrome/chrome_browser.gypi21
-rw-r--r--chrome/chrome_tests.gypi9
-rw-r--r--chrome/test/testing_browser_process.cc2
19 files changed, 95 insertions, 173 deletions
diff --git a/build/common.gypi b/build/common.gypi
index 0913ad3..fed6279 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -748,6 +748,9 @@
'defines': ['PPAPI_INSTANCE_REMOVE_SCRIPTING',
'PPAPI_VAR_REMOVE_SCRIPTING'],
}],
+ ['configuration_policy==1', {
+ 'defines': ['ENABLE_CONFIGURATION_POLICY'],
+ }],
['fastbuild!=0', {
'conditions': [
# For Windows, we don't genererate debug information.
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 243b5be..ca2f048 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -478,7 +478,9 @@ policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() {
if (!created_browser_policy_connector_) {
DCHECK(browser_policy_connector_.get() == NULL);
created_browser_policy_connector_ = true;
+#if defined(ENABLE_CONFIGURATION_POLICY)
browser_policy_connector_.reset(policy::BrowserPolicyConnector::Create());
+#endif
}
return browser_policy_connector_.get();
}
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc
index cf44547..1915234 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc
@@ -845,10 +845,18 @@ bool ConfigurationPolicyPrefKeeper::HasProxyPolicy(
return true;
}
-// static
-ConfigurationPolicyPrefStore* ConfigurationPolicyPrefStore::Create(
- ConfigurationPolicyProvider* provider) {
- return new ConfigurationPolicyPrefStore(provider);
+ConfigurationPolicyPrefStore::ConfigurationPolicyPrefStore(
+ ConfigurationPolicyProvider* provider)
+ : provider_(provider),
+ initialization_complete_(false) {
+ if (provider_) {
+ // Read initial policy.
+ policy_keeper_.reset(new ConfigurationPolicyPrefKeeper(provider));
+ registrar_.Init(provider_, this);
+ initialization_complete_ = provider->IsInitializationComplete();
+ } else {
+ initialization_complete_ = true;
+ }
}
ConfigurationPolicyPrefStore::~ConfigurationPolicyPrefStore() {
@@ -1094,20 +1102,6 @@ ConfigurationPolicyPrefStore::IsProxyPolicy(ConfigurationPolicyType policy) {
policy == kPolicyProxyBypassList;
}
-ConfigurationPolicyPrefStore::ConfigurationPolicyPrefStore(
- ConfigurationPolicyProvider* provider)
- : provider_(provider),
- initialization_complete_(false) {
- if (provider_) {
- // Read initial policy.
- policy_keeper_.reset(new ConfigurationPolicyPrefKeeper(provider));
- registrar_.Init(provider_, this);
- initialization_complete_ = provider->IsInitializationComplete();
- } else {
- initialization_complete_ = true;
- }
-}
-
void ConfigurationPolicyPrefStore::Refresh() {
if (!provider_)
return;
diff --git a/chrome/browser/policy/configuration_policy_pref_store.h b/chrome/browser/policy/configuration_policy_pref_store.h
index 44459eb..1d24b82 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.h
+++ b/chrome/browser/policy/configuration_policy_pref_store.h
@@ -29,8 +29,7 @@ class ConfigurationPolicyPrefStore
public:
// The ConfigurationPolicyPrefStore does not take ownership of the
// passed-in |provider|.
- static ConfigurationPolicyPrefStore* Create(
- ConfigurationPolicyProvider* provider);
+ explicit ConfigurationPolicyPrefStore(ConfigurationPolicyProvider* provider);
virtual ~ConfigurationPolicyPrefStore();
// PrefStore methods:
@@ -66,8 +65,6 @@ class ConfigurationPolicyPrefStore
static bool IsProxyPolicy(ConfigurationPolicyType policy);
private:
- explicit ConfigurationPolicyPrefStore(ConfigurationPolicyProvider* provider);
-
// Refreshes policy information, rereading policy from the provider and
// sending out change notifications as appropriate.
void Refresh();
diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
index ca1449f..23ea447 100644
--- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
@@ -38,7 +38,7 @@ class ConfigurationPolicyPrefStoreTestBase : public TESTBASE {
protected:
ConfigurationPolicyPrefStoreTestBase()
: provider_(),
- store_(ConfigurationPolicyPrefStore::Create(&provider_)) {}
+ store_(new ConfigurationPolicyPrefStore(&provider_)) {}
MockConfigurationPolicyProvider provider_;
scoped_refptr<ConfigurationPolicyPrefStore> store_;
@@ -328,7 +328,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptions) {
kPolicyManuallyConfiguredProxyServerMode));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(
*store, "chromium.org", "", "http://chromium.org/override",
ProxyPrefs::MODE_FIXED_SERVERS);
@@ -344,7 +344,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsReversedApplyOrder) {
provider.AddPolicy(kPolicyProxyServer,
Value::CreateStringValue("chromium.org"));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(
*store, "chromium.org", "", "http://chromium.org/override",
ProxyPrefs::MODE_FIXED_SERVERS);
@@ -357,7 +357,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsInvalid) {
kPolicyManuallyConfiguredProxyServerMode));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
const Value* value = NULL;
EXPECT_EQ(PrefStore::READ_NO_VALUE, store->GetValue(prefs::kProxy, &value));
}
@@ -369,7 +369,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyServerMode) {
Value::CreateIntegerValue(kPolicyNoProxyServerMode));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "", "", ProxyPrefs::MODE_DIRECT);
}
@@ -380,7 +380,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyModeName) {
Value::CreateStringValue(ProxyPrefs::kDirectProxyModeName));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "", "", ProxyPrefs::MODE_DIRECT);
}
@@ -391,7 +391,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyServerMode) {
Value::CreateIntegerValue(kPolicyAutoDetectProxyServerMode));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "", "", ProxyPrefs::MODE_AUTO_DETECT);
}
@@ -402,7 +402,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyModeName) {
Value::CreateStringValue(ProxyPrefs::kAutoDetectProxyModeName));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "", "", ProxyPrefs::MODE_AUTO_DETECT);
}
@@ -415,7 +415,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyMode) {
Value::CreateStringValue(ProxyPrefs::kPacScriptProxyModeName));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "http://short.org/proxy.pac", "",
ProxyPrefs::MODE_PAC_SCRIPT);
}
@@ -427,7 +427,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeInvalid) {
Value::CreateStringValue(ProxyPrefs::kPacScriptProxyModeName));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
const Value* value = NULL;
EXPECT_EQ(PrefStore::READ_NO_VALUE, store->GetValue(prefs::kProxy, &value));
}
@@ -445,7 +445,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeBug78016) {
Value::CreateStringValue(ProxyPrefs::kPacScriptProxyModeName));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "http://short.org/proxy.pac", "",
ProxyPrefs::MODE_PAC_SCRIPT);
}
@@ -457,7 +457,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyServerMode) {
Value::CreateIntegerValue(kPolicyUseSystemProxyServerMode));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "", "", ProxyPrefs::MODE_SYSTEM);
}
@@ -468,7 +468,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyMode) {
Value::CreateStringValue(ProxyPrefs::kSystemProxyModeName));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "", "", ProxyPrefs::MODE_SYSTEM);
}
@@ -482,7 +482,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest,
Value::CreateStringValue(ProxyPrefs::kAutoDetectProxyModeName));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
VerifyProxyPrefs(*store, "", "", "", ProxyPrefs::MODE_AUTO_DETECT);
}
@@ -500,7 +500,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ProxyInvalid) {
Value::CreateStringValue("chromium.org"));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
const Value* value = NULL;
EXPECT_EQ(PrefStore::READ_NO_VALUE,
store->GetValue(prefs::kProxy, &value));
@@ -521,7 +521,7 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MinimallyDefined) {
Value::CreateStringValue(search_url));
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
const Value* value = NULL;
EXPECT_EQ(PrefStore::READ_OK,
@@ -580,7 +580,7 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, FullyDefined) {
provider.AddPolicy(kPolicyDefaultSearchProviderEncodings, encodings);
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
const Value* value = NULL;
EXPECT_EQ(PrefStore::READ_OK,
@@ -632,7 +632,7 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MissingUrl) {
provider.AddPolicy(kPolicyDefaultSearchProviderEncodings, encodings);
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
EXPECT_EQ(PrefStore::READ_NO_VALUE,
store->GetValue(prefs::kDefaultSearchProviderSearchURL, NULL));
@@ -675,7 +675,7 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Invalid) {
provider.AddPolicy(kPolicyDefaultSearchProviderEncodings, encodings);
scoped_refptr<ConfigurationPolicyPrefStore> store(
- ConfigurationPolicyPrefStore::Create(&provider));
+ new ConfigurationPolicyPrefStore(&provider));
EXPECT_EQ(PrefStore::READ_NO_VALUE,
store->GetValue(prefs::kDefaultSearchProviderSearchURL, NULL));
diff --git a/chrome/browser/policy/policy_stubs.cc b/chrome/browser/policy/policy_stubs.cc
deleted file mode 100644
index f039479..0000000
--- a/chrome/browser/policy/policy_stubs.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/policy/browser_policy_connector.h"
-#include "chrome/browser/policy/configuration_policy_pref_store.h"
-#include "chrome/browser/policy/cloud_policy_data_store.h"
-#include "chrome/browser/policy/cloud_policy_provider.h"
-#include "chrome/browser/policy/cloud_policy_subsystem.h"
-#include "chrome/browser/policy/user_policy_token_cache.h"
-
-// Policies are optionally built, hence the following stubs.
-
-namespace policy {
-
-// static
-BrowserPolicyConnector* BrowserPolicyConnector::Create() {
- return NULL;
-}
-
-// static
-BrowserPolicyConnector* BrowserPolicyConnector::CreateForTests() {
- return NULL;
-}
-
-BrowserPolicyConnector::~BrowserPolicyConnector() {
-}
-
-void BrowserPolicyConnector::Observe(int type,
- const NotificationSource& source,
- const NotificationDetails& details) {
-}
-
-// static
-const ConfigurationPolicyProvider::PolicyDefinitionList*
-ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() {
- return NULL;
-}
-
-// static
-ConfigurationPolicyPrefStore* ConfigurationPolicyPrefStore::Create(
- ConfigurationPolicyProvider* provider) {
- return NULL;
-}
-
-// static
-ConfigurationPolicyPrefStore*
-ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore() {
- return NULL;
-}
-
-// static
-ConfigurationPolicyPrefStore*
-ConfigurationPolicyPrefStore::CreateManagedCloudPolicyPrefStore() {
- return NULL;
-}
-
-// static
-ConfigurationPolicyPrefStore*
-ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore() {
- return NULL;
-}
-
-// static
-ConfigurationPolicyPrefStore*
-ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore() {
- return NULL;
-}
-
-// static
-void CloudPolicySubsystem::RegisterPrefs(PrefService* local_state) {
- // don't need prefs for things we don't use.
-}
-
-} // namespace policy
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 9863add..3c78aef 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -113,7 +113,9 @@ void RegisterLocalState(PrefService* local_state) {
BackgroundModeManager::RegisterPrefs(local_state);
NotificationUIManager::RegisterPrefs(local_state);
PrefProxyConfigService::RegisterPrefs(local_state);
+#if defined(ENABLE_CONFIGURATION_POLICY)
policy::CloudPolicySubsystem::RegisterPrefs(local_state);
+#endif
ProfileInfoCache::RegisterPrefs(local_state);
ProfileManager::RegisterPrefs(local_state);
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc
index 716e584..341822e 100644
--- a/chrome/browser/prefs/pref_service.cc
+++ b/chrome/browser/prefs/pref_service.cc
@@ -128,19 +128,27 @@ PrefService* PrefService::CreatePrefService(const FilePath& pref_filename,
}
#endif
+#if defined(ENABLE_CONFIGURATION_POLICY)
ConfigurationPolicyPrefStore* managed_platform =
ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore();
ConfigurationPolicyPrefStore* managed_cloud =
ConfigurationPolicyPrefStore::CreateManagedCloudPolicyPrefStore();
+ ConfigurationPolicyPrefStore* recommended_platform =
+ ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore();
+ ConfigurationPolicyPrefStore* recommended_cloud =
+ ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore();
+#else
+ ConfigurationPolicyPrefStore* managed_platform = NULL;
+ ConfigurationPolicyPrefStore* managed_cloud = NULL;
+ ConfigurationPolicyPrefStore* recommended_platform = NULL;
+ ConfigurationPolicyPrefStore* recommended_cloud = NULL;
+#endif // ENABLE_CONFIGURATION_POLICY
+
CommandLinePrefStore* command_line =
new CommandLinePrefStore(CommandLine::ForCurrentProcess());
JsonPrefStore* user = new JsonPrefStore(
pref_filename,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
- ConfigurationPolicyPrefStore* recommended_platform =
- ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore();
- ConfigurationPolicyPrefStore* recommended_cloud =
- ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore();
DefaultPrefStore* default_pref_store = new DefaultPrefStore();
return new PrefService(
diff --git a/chrome/browser/prefs/pref_service_mock_builder.cc b/chrome/browser/prefs/pref_service_mock_builder.cc
index edffa80..09fca07 100644
--- a/chrome/browser/prefs/pref_service_mock_builder.cc
+++ b/chrome/browser/prefs/pref_service_mock_builder.cc
@@ -60,18 +60,18 @@ PrefServiceMockBuilder::WithRecommendedCloudPrefs(PrefStore* store) {
return *this;
}
+#if defined(ENABLE_CONFIGURATION_POLICY)
PrefServiceMockBuilder&
PrefServiceMockBuilder::WithManagedPlatformProvider(
policy::ConfigurationPolicyProvider* provider) {
- managed_platform_prefs_ = policy::ConfigurationPolicyPrefStore::Create(
- provider);
+ managed_platform_prefs_ = new policy::ConfigurationPolicyPrefStore(provider);
return *this;
}
PrefServiceMockBuilder&
PrefServiceMockBuilder::WithManagedCloudProvider(
policy::ConfigurationPolicyProvider* provider) {
- managed_cloud_prefs_ = policy::ConfigurationPolicyPrefStore::Create(provider);
+ managed_cloud_prefs_ = new policy::ConfigurationPolicyPrefStore(provider);
return *this;
}
@@ -79,17 +79,17 @@ PrefServiceMockBuilder&
PrefServiceMockBuilder::WithRecommendedPlatformProvider(
policy::ConfigurationPolicyProvider* provider) {
recommended_platform_prefs_ =
- policy::ConfigurationPolicyPrefStore::Create(provider);
+ new policy::ConfigurationPolicyPrefStore(provider);
return *this;
}
PrefServiceMockBuilder&
PrefServiceMockBuilder::WithRecommendedCloudProvider(
policy::ConfigurationPolicyProvider* provider) {
- recommended_cloud_prefs_ = policy::ConfigurationPolicyPrefStore::Create(
- provider);
+ recommended_cloud_prefs_ = new policy::ConfigurationPolicyPrefStore(provider);
return *this;
}
+#endif
PrefServiceMockBuilder&
PrefServiceMockBuilder::WithCommandLine(CommandLine* command_line) {
diff --git a/chrome/browser/prefs/pref_service_mock_builder.h b/chrome/browser/prefs/pref_service_mock_builder.h
index 24fc671..7beb084 100644
--- a/chrome/browser/prefs/pref_service_mock_builder.h
+++ b/chrome/browser/prefs/pref_service_mock_builder.h
@@ -36,6 +36,7 @@ class PrefServiceMockBuilder {
PrefServiceMockBuilder& WithRecommendedPlatformPrefs(PrefStore* store);
PrefServiceMockBuilder& WithRecommendedCloudPrefs(PrefStore* store);
+#if defined(ENABLE_CONFIGURATION_POLICY)
// Set up policy pref stores using the given policy provider.
PrefServiceMockBuilder& WithManagedPlatformProvider(
policy::ConfigurationPolicyProvider* provider);
@@ -45,6 +46,7 @@ class PrefServiceMockBuilder {
policy::ConfigurationPolicyProvider* provider);
PrefServiceMockBuilder& WithRecommendedCloudProvider(
policy::ConfigurationPolicyProvider* provider);
+#endif
// Specifies to use an actual command-line backed command-line pref store.
PrefServiceMockBuilder& WithCommandLine(CommandLine* command_line);
diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.cc b/chrome/browser/ui/webui/options/advanced_options_handler.cc
index ac4491d..78bdf1b 100644
--- a/chrome/browser/ui/webui/options/advanced_options_handler.cc
+++ b/chrome/browser/ui/webui/options/advanced_options_handler.cc
@@ -203,10 +203,12 @@ void AdvancedOptionsHandler::Initialize() {
SetupBackgroundModeSettings();
#endif
+#if defined(ENABLE_CONFIGURATION_POLICY)
banner_handler_.reset(
- OptionsManagedBannerHandler::Create(web_ui_,
- ASCIIToUTF16("AdvancedOptions"),
- OPTIONS_PAGE_ADVANCED));
+ new OptionsManagedBannerHandler(web_ui_,
+ ASCIIToUTF16("AdvancedOptions"),
+ OPTIONS_PAGE_ADVANCED));
+#endif
}
WebUIMessageHandler* AdvancedOptionsHandler::Attach(WebUI* web_ui) {
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index e8f0fc1..386b8b3 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -148,10 +148,12 @@ void BrowserOptionsHandler::Initialize() {
pref_change_registrar_.Add(prefs::kURLsToRestoreOnStartup, this);
UpdateSearchEngines();
+#if defined(ENABLE_CONFIGURATION_POLICY)
banner_handler_.reset(
- OptionsManagedBannerHandler::Create(web_ui_,
- ASCIIToUTF16("BrowserOptions"),
- OPTIONS_PAGE_GENERAL));
+ new OptionsManagedBannerHandler(web_ui_,
+ ASCIIToUTF16("BrowserOptions"),
+ OPTIONS_PAGE_GENERAL));
+#endif
autocomplete_controller_.reset(new AutocompleteController(profile, this));
}
diff --git a/chrome/browser/ui/webui/options/options_managed_banner_handler.cc b/chrome/browser/ui/webui/options/options_managed_banner_handler.cc
index 6d98bee..ddf3785 100644
--- a/chrome/browser/ui/webui/options/options_managed_banner_handler.cc
+++ b/chrome/browser/ui/webui/options/options_managed_banner_handler.cc
@@ -9,12 +9,6 @@
#include "chrome/browser/profiles/profile.h"
#include "content/browser/webui/web_ui.h"
-// static
-OptionsManagedBannerHandler* OptionsManagedBannerHandler::Create(
- WebUI* web_ui, const string16& page_name, OptionsPage page) {
- return new OptionsManagedBannerHandler(web_ui, page_name, page);
-}
-
OptionsManagedBannerHandler::OptionsManagedBannerHandler(
WebUI* web_ui, const string16& page_name, OptionsPage page)
: policy::ManagedPrefsBannerBase(web_ui->GetProfile()->GetPrefs(), page),
diff --git a/chrome/browser/ui/webui/options/options_managed_banner_handler.h b/chrome/browser/ui/webui/options/options_managed_banner_handler.h
index 202d82d..95a8d2a 100644
--- a/chrome/browser/ui/webui/options/options_managed_banner_handler.h
+++ b/chrome/browser/ui/webui/options/options_managed_banner_handler.h
@@ -18,9 +18,9 @@ class WebUI;
// that are under administator control.
class OptionsManagedBannerHandler : public policy::ManagedPrefsBannerBase {
public:
- static OptionsManagedBannerHandler* Create(WebUI* web_ui,
- const string16& page_name,
- OptionsPage page);
+ OptionsManagedBannerHandler(WebUI* web_ui,
+ const string16& page_name,
+ OptionsPage page);
virtual ~OptionsManagedBannerHandler();
protected:
@@ -28,10 +28,6 @@ class OptionsManagedBannerHandler : public policy::ManagedPrefsBannerBase {
virtual void OnUpdateVisibility();
private:
- OptionsManagedBannerHandler(WebUI* web_ui,
- const string16& page_name,
- OptionsPage page);
-
// Set the managed options banner to be visible or invisible.
void SetupBannerVisibility();
diff --git a/chrome/browser/ui/webui/options/options_managed_banner_handler_stub.cc b/chrome/browser/ui/webui/options/options_managed_banner_handler_stub.cc
deleted file mode 100644
index 18969be..0000000
--- a/chrome/browser/ui/webui/options/options_managed_banner_handler_stub.cc
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/options/options_managed_banner_handler.h"
-
-// static
-OptionsManagedBannerHandler* OptionsManagedBannerHandler::Create(
- WebUI* web_ui, const string16& page_name, OptionsPage page) {
- return NULL;
-}
diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc
index 36428cc..48b9525 100644
--- a/chrome/browser/ui/webui/options/personal_options_handler.cc
+++ b/chrome/browser/ui/webui/options/personal_options_handler.cc
@@ -349,10 +349,12 @@ void PersonalOptionsHandler::ObserveThemeChanged() {
}
void PersonalOptionsHandler::Initialize() {
+#if defined(ENABLE_CONFIGURATION_POLICY)
banner_handler_.reset(
- OptionsManagedBannerHandler::Create(web_ui_,
- ASCIIToUTF16("PersonalOptions"),
- OPTIONS_PAGE_CONTENT));
+ new OptionsManagedBannerHandler(web_ui_,
+ ASCIIToUTF16("PersonalOptions"),
+ OPTIONS_PAGE_CONTENT));
+#endif
// Listen for theme installation.
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 76b99f0..d5f9749 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1656,7 +1656,6 @@
'<(protoc_out_dir)/chrome/browser/policy/proto/chrome_device_policy.pb.h',
'<(protoc_out_dir)/chrome/browser/policy/proto/device_management_backend.pb.cc',
'<(protoc_out_dir)/chrome/browser/policy/proto/device_management_backend.pb.h',
- 'browser/policy/policy_stubs.cc',
'browser/policy/proto/device_management_constants.cc',
'browser/policy/proto/device_management_constants.h',
'<(protoc_out_dir)/chrome/browser/policy/proto/device_management_local.pb.cc',
@@ -3556,7 +3555,6 @@
'browser/ui/webui/options/language_options_handler_common.h',
'browser/ui/webui/options/options_managed_banner_handler.cc',
'browser/ui/webui/options/options_managed_banner_handler.h',
- 'browser/ui/webui/options/options_managed_banner_handler_stub.cc',
'browser/ui/webui/options/options_ui.cc',
'browser/ui/webui/options/options_ui.h',
'browser/ui/webui/options/password_manager_handler.cc',
@@ -3683,17 +3681,14 @@
'DEBUG_DEVTOOLS=1',
],
}],
- ['configuration_policy==1', {
- 'sources!': [
- 'browser/policy/policy_stubs.cc',
- 'browser/ui/webui/options/options_managed_banner_handler_stub.cc',
- ],
- }, {
- 'sources/': [
- ['exclude', '^browser/policy/'],
- ['include', '^browser/policy/policy_stubs.cc'],
- ['exclude', '^browser/ui/webui/options/options_managed_banner_handler.cc'],
- ],
+ ['configuration_policy==0', {
+ 'sources!': [
+ 'browser/ui/webui/options/options_managed_banner_handler.cc',
+ ],
+ 'sources/': [
+ ['exclude', '^browser/policy/'],
+ ['include', '^browser/policy/policy_path_parser'],
+ ],
}],
['safe_browsing==1', {
'defines': [
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index c79b10c..ea6b9b8a 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2063,9 +2063,11 @@
],
}],
['configuration_policy==0', {
+ 'sources!': [
+ 'browser/prefs/proxy_policy_unittest.cc',
+ ],
'sources/': [
['exclude', '^browser/policy/'],
- ['exclude', '^browser/prefs/proxy_policy_unittest.cc'],
],
}],
['safe_browsing==1', {
@@ -2621,6 +2623,11 @@
'browser/extensions/extension_input_apitest.cc',
],
}],
+ ['configuration_policy==0', {
+ 'sources/': [
+ ['exclude', '^browser/policy/'],
+ ],
+ }],
['safe_browsing==1', {
'defines': [
'ENABLE_SAFE_BROWSING',
diff --git a/chrome/test/testing_browser_process.cc b/chrome/test/testing_browser_process.cc
index a6607ab..b3cde66 100644
--- a/chrome/test/testing_browser_process.cc
+++ b/chrome/test/testing_browser_process.cc
@@ -77,10 +77,12 @@ PrefService* TestingBrowserProcess::local_state() {
policy::BrowserPolicyConnector*
TestingBrowserProcess::browser_policy_connector() {
+#if defined(ENABLE_CONFIGURATION_POLICY)
if (!browser_policy_connector_.get()) {
browser_policy_connector_.reset(
policy::BrowserPolicyConnector::CreateForTests());
}
+#endif
return browser_policy_connector_.get();
}