Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Unified Diff: chrome/browser/policy/device_policy_cache.cc

Issue 9111022: Removed ConfigurationPolicyType and extended PolicyMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/device_policy_cache.cc
diff --git a/chrome/browser/policy/device_policy_cache.cc b/chrome/browser/policy/device_policy_cache.cc
index ff1c38a5ad4bcdfb2590232e459bb4e30a25aba5..3ad93ecd48ffc623a5284b522cf13315821e25a3 100644
--- a/chrome/browser/policy/device_policy_cache.cc
+++ b/chrome/browser/policy/device_policy_cache.cc
@@ -26,7 +26,6 @@
#include "chrome/browser/policy/policy_map.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
#include "chrome/browser/policy/proto/device_management_local.pb.h"
-#include "policy/configuration_policy_type.h"
namespace em = enterprise_management;
@@ -225,14 +224,13 @@ void DevicePolicyCache::OnRetrievePolicyCompleted(
}
bool DevicePolicyCache::DecodePolicyData(const em::PolicyData& policy_data,
- PolicyMap* mandatory,
- PolicyMap* recommended) {
+ PolicyMap* policies) {
em::ChromeDeviceSettingsProto policy;
if (!policy.ParseFromString(policy_data.policy_value())) {
LOG(WARNING) << "Failed to parse ChromeDeviceSettingsProto.";
return false;
}
- DecodeDevicePolicy(policy, mandatory, recommended);
+ DecodeDevicePolicy(policy, policies);
return true;
}
@@ -312,15 +310,15 @@ void DevicePolicyCache::InstallInitialPolicy(
// static
void DevicePolicyCache::DecodeDevicePolicy(
const em::ChromeDeviceSettingsProto& policy,
- PolicyMap* mandatory,
- PolicyMap* recommended) {
+ PolicyMap* policies) {
if (policy.has_device_policy_refresh_rate()) {
const em::DevicePolicyRefreshRateProto container =
policy.device_policy_refresh_rate();
if (container.has_device_policy_refresh_rate()) {
- mandatory->Set(kPolicyDevicePolicyRefreshRate,
- DecodeIntegerValue(
- container.device_policy_refresh_rate()));
+ policies->Set(key::kDevicePolicyRefreshRate,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_DEVICE,
+ DecodeIntegerValue(container.device_policy_refresh_rate()));
}
}
@@ -328,28 +326,38 @@ void DevicePolicyCache::DecodeDevicePolicy(
const em::DeviceProxySettingsProto container =
policy.device_proxy_settings();
if (container.has_proxy_mode()) {
- recommended->Set(kPolicyProxyMode,
- Value::CreateStringValue(container.proxy_mode()));
+ policies->Set(key::kProxyMode,
+ POLICY_LEVEL_RECOMMENDED,
+ POLICY_SCOPE_DEVICE,
+ Value::CreateStringValue(container.proxy_mode()));
}
if (container.has_proxy_server()) {
- recommended->Set(kPolicyProxyServer,
- Value::CreateStringValue(container.proxy_server()));
+ policies->Set(key::kProxyServer,
+ POLICY_LEVEL_RECOMMENDED,
+ POLICY_SCOPE_DEVICE,
+ Value::CreateStringValue(container.proxy_server()));
}
if (container.has_proxy_pac_url()) {
- recommended->Set(kPolicyProxyPacUrl,
- Value::CreateStringValue(container.proxy_pac_url()));
+ policies->Set(key::kProxyPacUrl,
+ POLICY_LEVEL_RECOMMENDED,
+ POLICY_SCOPE_DEVICE,
+ Value::CreateStringValue(container.proxy_pac_url()));
}
if (container.has_proxy_bypass_list()) {
- recommended->Set(kPolicyProxyBypassList,
- Value::CreateStringValue(container.proxy_bypass_list()));
+ policies->Set(key::kProxyBypassList,
+ POLICY_LEVEL_RECOMMENDED,
+ POLICY_SCOPE_DEVICE,
+ Value::CreateStringValue(container.proxy_bypass_list()));
}
}
if (policy.has_release_channel() &&
policy.release_channel().has_release_channel()) {
std::string channel(policy.release_channel().release_channel());
- mandatory->Set(kPolicyChromeOsReleaseChannel,
- Value::CreateStringValue(channel));
+ policies->Set(key::kChromeOsReleaseChannel,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_DEVICE,
+ Value::CreateStringValue(channel));
// TODO(dubroy): Once http://crosbug.com/17015 is implemented, we won't
// have to pass the channel in here, only ping the update engine to tell
// it to fetch the channel from the policy.
@@ -361,8 +369,10 @@ void DevicePolicyCache::DecodeDevicePolicy(
policy.open_network_configuration().has_open_network_configuration()) {
std::string config(
policy.open_network_configuration().open_network_configuration());
- mandatory->Set(kPolicyDeviceOpenNetworkConfiguration,
- Value::CreateStringValue(config));
+ policies->Set(key::kDeviceOpenNetworkConfiguration,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_DEVICE,
+ Value::CreateStringValue(config));
}
}

Powered by Google App Engine
This is Rietveld 408576698