| Index: chrome/browser/policy/user_policy_cache.cc
|
| diff --git a/chrome/browser/policy/user_policy_cache.cc b/chrome/browser/policy/user_policy_cache.cc
|
| index 62ec294305d4110a607f2e342cdc7f7c8ab50106..ede38b5559b86cd267091e8b45774ab58e19cd22 100644
|
| --- a/chrome/browser/policy/user_policy_cache.cc
|
| +++ b/chrome/browser/policy/user_policy_cache.cc
|
| @@ -16,18 +16,16 @@
|
| #include "chrome/browser/policy/proto/cloud_policy.pb.h"
|
| #include "chrome/browser/policy/proto/device_management_local.pb.h"
|
| #include "chrome/browser/policy/proto/old_generic_format.pb.h"
|
| -#include "policy/configuration_policy_type.h"
|
| #include "policy/policy_constants.h"
|
|
|
| namespace em = enterprise_management;
|
|
|
| namespace policy {
|
|
|
| -// Decodes a CloudPolicySettings object into two maps with mandatory and
|
| -// recommended settings, respectively. The implementation is generated code
|
| -// in policy/cloud_policy_generated.cc.
|
| -void DecodePolicy(const em::CloudPolicySettings& policy,
|
| - PolicyMap* mandatory, PolicyMap* recommended);
|
| +// Decodes a CloudPolicySettings object into a PolicyMap. All the policies will
|
| +// be POLICY_SCOPE_USER. The PolicyLevel is decoded from the protobuf.
|
| +// The implementation is generated code in policy/cloud_policy_generated.cc.
|
| +void DecodePolicy(const em::CloudPolicySettings& policy, PolicyMap* map);
|
|
|
| UserPolicyCache::UserPolicyCache(const FilePath& backing_file_path,
|
| bool wait_for_policy_fetch)
|
| @@ -106,8 +104,7 @@ void UserPolicyCache::OnDiskCacheLoaded(
|
| }
|
|
|
| bool UserPolicyCache::DecodePolicyData(const em::PolicyData& policy_data,
|
| - PolicyMap* mandatory,
|
| - PolicyMap* recommended) {
|
| + PolicyMap* policies) {
|
| // TODO(jkummerow): Verify policy_data.device_token(). Needs final
|
| // specification which token we're actually sending / expecting to get back.
|
| em::CloudPolicySettings policy;
|
| @@ -115,8 +112,8 @@ bool UserPolicyCache::DecodePolicyData(const em::PolicyData& policy_data,
|
| LOG(WARNING) << "Failed to parse CloudPolicySettings protobuf.";
|
| return false;
|
| }
|
| - DecodePolicy(policy, mandatory, recommended);
|
| - MaybeDecodeOldstylePolicy(policy_data.policy_value(), mandatory, recommended);
|
| + DecodePolicy(policy, policies);
|
| + MaybeDecodeOldstylePolicy(policy_data.policy_value(), policies);
|
| return true;
|
| }
|
|
|
| @@ -133,10 +130,9 @@ using google::protobuf::RepeatedPtrField;
|
|
|
| void UserPolicyCache::MaybeDecodeOldstylePolicy(
|
| const std::string& policy_data,
|
| - PolicyMap* mandatory,
|
| - PolicyMap* recommended) {
|
| + PolicyMap* policies) {
|
| // Return immediately if we already have policy information in the maps.
|
| - if (!mandatory->empty() || !recommended->empty())
|
| + if (!policies->empty())
|
| return;
|
| em::LegacyChromeSettingsProto policy;
|
| // Return if the input string doesn't match the protobuf definition.
|
| @@ -158,7 +154,10 @@ void UserPolicyCache::MaybeDecodeOldstylePolicy(
|
| result.Set(named_value->name(), decoded_value);
|
| }
|
| }
|
| - mandatory->LoadFrom(&result, GetChromePolicyDefinitionList());
|
| + policies->LoadFrom(&result,
|
| + GetChromePolicyDefinitionList(),
|
| + POLICY_LEVEL_MANDATORY,
|
| + POLICY_SCOPE_USER);
|
| }
|
|
|
| Value* UserPolicyCache::DecodeIntegerValue(
|
|
|