Commit 0d54d368 authored by treib's avatar treib Committed by Commit bot

Disable NTP Content Suggestions by default for enterprise users

BUG=638930

Review-Url: https://codereview.chromium.org/2282743002
Cr-Commit-Position: refs/heads/master@{#414724}
parent 529b3bc5
...@@ -149,6 +149,9 @@ std::string GetTestPolicy(const char* homepage, int key_version) { ...@@ -149,6 +149,9 @@ std::string GetTestPolicy(const char* homepage, int key_version) {
} }
void GetExpectedDefaultPolicy(PolicyMap* policy_map) { void GetExpectedDefaultPolicy(PolicyMap* policy_map) {
policy_map->Set(key::kNTPContentSuggestionsEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT,
base::WrapUnique(new base::FundamentalValue(false)), nullptr);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
policy_map->Set( policy_map->Set(
key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY, key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY,
...@@ -174,6 +177,8 @@ void GetExpectedDefaultPolicy(PolicyMap* policy_map) { ...@@ -174,6 +177,8 @@ void GetExpectedDefaultPolicy(PolicyMap* policy_map) {
} }
void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) { void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) {
GetExpectedDefaultPolicy(expected);
expected->Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, expected->Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, POLICY_SOURCE_CLOUD,
base::WrapUnique(new base::FundamentalValue(true)), nullptr); base::WrapUnique(new base::FundamentalValue(true)), nullptr);
...@@ -191,28 +196,6 @@ void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) { ...@@ -191,28 +196,6 @@ void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) {
expected->Set(key::kHomepageLocation, POLICY_LEVEL_RECOMMENDED, expected->Set(key::kHomepageLocation, POLICY_LEVEL_RECOMMENDED,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
base::WrapUnique(new base::StringValue(homepage)), nullptr); base::WrapUnique(new base::StringValue(homepage)), nullptr);
#if defined(OS_CHROMEOS)
expected->Set(key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT,
base::WrapUnique(new base::StringValue("primary-only")),
nullptr);
expected->Set(key::kEasyUnlockAllowed, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT,
base::WrapUnique(new base::FundamentalValue(false)), nullptr);
expected->Set(key::kCaptivePortalAuthenticationIgnoresProxy,
POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
base::WrapUnique(new base::FundamentalValue(false)), nullptr);
expected->Set(key::kAllowDinosaurEasterEgg, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT,
base::WrapUnique(new base::FundamentalValue(false)), nullptr);
expected->Set(key::kArcEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
base::WrapUnique(new base::FundamentalValue(false)), nullptr);
expected->Set(key::kPacHttpsUrlStrippingEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT,
base::WrapUnique(new base::FundamentalValue(false)), nullptr);
#endif
} }
} // namespace } // namespace
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "components/policy/core/common/cloud/user_cloud_policy_store.h" #include "components/policy/core/common/cloud/user_cloud_policy_store.h"
#include "components/policy/core/common/policy_pref_names.h" #include "components/policy/core/common/policy_pref_names.h"
#include "components/policy/core/common/policy_types.h" #include "components/policy/core/common/policy_types.h"
#include "components/policy/policy_constants.h"
#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_context_getter.h"
namespace em = enterprise_management; namespace em = enterprise_management;
...@@ -96,4 +97,23 @@ bool UserCloudPolicyManager::IsClientRegistered() const { ...@@ -96,4 +97,23 @@ bool UserCloudPolicyManager::IsClientRegistered() const {
return client() && client()->is_registered(); return client() && client()->is_registered();
} }
void UserCloudPolicyManager::GetChromePolicy(PolicyMap* policy_map) {
CloudPolicyManager::GetChromePolicy(policy_map);
// If the store has a verified policy blob received from the server then apply
// the defaults for policies that haven't been configured by the administrator
// given that this is an enterprise user.
// TODO(treib,atwilson): We should just call SetEnterpriseUsersDefaults here,
// see crbug.com/640950.
if (store()->has_policy() &&
!policy_map->Get(key::kNTPContentSuggestionsEnabled)) {
policy_map->Set(key::kNTPContentSuggestionsEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
base::MakeUnique<base::FundamentalValue>(false),
nullptr /* external_data_fetcher */);
}
}
} // namespace policy } // namespace policy
...@@ -80,6 +80,9 @@ class POLICY_EXPORT UserCloudPolicyManager : public CloudPolicyManager { ...@@ -80,6 +80,9 @@ class POLICY_EXPORT UserCloudPolicyManager : public CloudPolicyManager {
scoped_refptr<net::URLRequestContextGetter> request_context); scoped_refptr<net::URLRequestContextGetter> request_context);
private: private:
// CloudPolicyManager:
void GetChromePolicy(PolicyMap* policy_map) override;
// Typed pointer to the store owned by UserCloudPolicyManager. Note that // Typed pointer to the store owned by UserCloudPolicyManager. Note that
// CloudPolicyManager only keeps a plain CloudPolicyStore pointer. // CloudPolicyManager only keeps a plain CloudPolicyStore pointer.
std::unique_ptr<UserCloudPolicyStore> store_; std::unique_ptr<UserCloudPolicyStore> store_;
......
...@@ -8822,6 +8822,7 @@ ...@@ -8822,6 +8822,7 @@
}, },
'example_value': True, 'example_value': True,
'id': 338, 'id': 338,
'default_for_enterprise_users': False,
'caption': '''Show content suggestions on the New Tab page''', 'caption': '''Show content suggestions on the New Tab page''',
'tags': [], 'tags': [],
'desc': 'desc':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment