Chromium Code Reviews| 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..261076f38da1b5014d15810f759a11c70aed4442 100644 |
| --- a/chrome/browser/policy/device_policy_cache.cc |
| +++ b/chrome/browser/policy/device_policy_cache.cc |
| @@ -26,7 +26,7 @@ |
| #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" |
| +#include "policy/policy_constants.h" |
| namespace em = enterprise_management; |
| @@ -225,14 +225,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 +311,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 +327,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, |
|
Mattias Nissler (ping if slow)
2012/01/17 09:52:45
maybe we should create a proper proxy config dicti
Joao da Silva
2012/01/17 13:09:29
Done.
The keys for the dictionary are the old pol
|
| + 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 +370,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)); |
| } |
| } |