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

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

Issue 9111022: Removed ConfigurationPolicyType and extended PolicyMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 11 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
« no previous file with comments | « chrome/browser/policy/user_policy_cache.h ('k') | chrome/browser/policy/user_policy_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « chrome/browser/policy/user_policy_cache.h ('k') | chrome/browser/policy/user_policy_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698