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

Side by Side Diff: chrome/browser/policy/cloud/user_cloud_policy_store_base.cc

Issue 19462006: Implement fetching, caching and retrieval of external policy data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/cloud/user_cloud_policy_store_base.h" 5 #include "chrome/browser/policy/cloud/user_cloud_policy_store_base.h"
6 6
7 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h"
7 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 8 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
9 #include "chrome/browser/policy/policy_map.h"
8 #include "policy/proto/cloud_policy.pb.h" 10 #include "policy/proto/cloud_policy.pb.h"
9 11
10 namespace policy { 12 namespace policy {
11 13
12 // Decodes a CloudPolicySettings object into a policy map. The implementation is 14 // Decodes a CloudPolicySettings object into a policy map. The implementation is
13 // generated code in policy/cloud_policy_generated.cc. 15 // generated code in policy/cloud_policy_generated.cc.
14 void DecodePolicy(const enterprise_management::CloudPolicySettings& policy, 16 void DecodePolicy(const enterprise_management::CloudPolicySettings& policy,
17 base::WeakPtr<CloudExternalDataManager> external_data_manager,
15 PolicyMap* policies); 18 PolicyMap* policies);
16 19
17 UserCloudPolicyStoreBase::UserCloudPolicyStoreBase() { 20 UserCloudPolicyStoreBase::UserCloudPolicyStoreBase() {
18 } 21 }
19 22
20 UserCloudPolicyStoreBase::~UserCloudPolicyStoreBase() { 23 UserCloudPolicyStoreBase::~UserCloudPolicyStoreBase() {
21 } 24 }
22 25
23 scoped_ptr<UserCloudPolicyValidator> UserCloudPolicyStoreBase::CreateValidator( 26 scoped_ptr<UserCloudPolicyValidator> UserCloudPolicyStoreBase::CreateValidator(
24 scoped_ptr<enterprise_management::PolicyFetchResponse> policy) { 27 scoped_ptr<enterprise_management::PolicyFetchResponse> policy) {
25 // Configure the validator. 28 // Configure the validator.
26 UserCloudPolicyValidator* validator = 29 UserCloudPolicyValidator* validator =
27 UserCloudPolicyValidator::Create(policy.Pass()); 30 UserCloudPolicyValidator::Create(policy.Pass());
28 validator->ValidatePolicyType(GetChromeUserPolicyType()); 31 validator->ValidatePolicyType(GetChromeUserPolicyType());
29 validator->ValidateAgainstCurrentPolicy( 32 validator->ValidateAgainstCurrentPolicy(
30 policy_.get(), 33 policy_.get(),
31 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED, 34 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED,
32 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED); 35 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED);
33 validator->ValidatePayload(); 36 validator->ValidatePayload();
34 return scoped_ptr<UserCloudPolicyValidator>(validator); 37 return scoped_ptr<UserCloudPolicyValidator>(validator);
35 } 38 }
36 39
37 void UserCloudPolicyStoreBase::InstallPolicy( 40 void UserCloudPolicyStoreBase::InstallPolicy(
38 scoped_ptr<enterprise_management::PolicyData> policy_data, 41 scoped_ptr<enterprise_management::PolicyData> policy_data,
39 scoped_ptr<enterprise_management::CloudPolicySettings> payload) { 42 scoped_ptr<enterprise_management::CloudPolicySettings> payload) {
40 // Decode the payload. 43 // Decode the payload.
41 policy_map_.Clear(); 44 policy_map_.Clear();
42 DecodePolicy(*payload, &policy_map_); 45 DecodePolicy(*payload, external_data_manager(), &policy_map_);
43 policy_ = policy_data.Pass(); 46 policy_ = policy_data.Pass();
44 } 47 }
45 48
46 } // namespace policy 49 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_store.cc ('k') | chrome/browser/policy/external_data_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698