1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_CLOUD_POLICY_STORE_BASE_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_CLOUD_POLICY_STORE_BASE_H_
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "components/policy/core/common/cloud/cloud_policy_store.h"
15 #include "components/policy/core/common/cloud/cloud_policy_validator.h"
16 #include "components/policy/policy_export.h"
19 class SequencedTaskRunner;
24 // Base class that implements common cross-platform UserCloudPolicyStore
26 class POLICY_EXPORT UserCloudPolicyStoreBase : public CloudPolicyStore {
28 explicit UserCloudPolicyStoreBase(
29 scoped_refptr<base::SequencedTaskRunner> background_task_runner);
30 ~UserCloudPolicyStoreBase() override;
33 // Creates a validator configured to validate a user policy. The caller owns
34 // the resulting object until StartValidation() is invoked.
35 scoped_ptr<UserCloudPolicyValidator> CreateValidator(
36 scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
37 CloudPolicyValidatorBase::ValidateTimestampOption option);
39 // Sets |policy_data| and |payload| as the active policy.
41 scoped_ptr<enterprise_management::PolicyData> policy_data,
42 scoped_ptr<enterprise_management::CloudPolicySettings> payload);
44 scoped_refptr<base::SequencedTaskRunner> background_task_runner() const {
45 return background_task_runner_;
49 // Task runner for background file operations.
50 scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
52 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreBase);
57 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_CLOUD_POLICY_STORE_BASE_H_