blob: 63e59a321f2216379d4044f2ac61eb62f0402900 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_MACHINE_LEVEL_USER_CLOUD_POLICY_MANAGER_H_
#define COMPONENTS_POLICY_CORE_COMMON_CLOUD_MACHINE_LEVEL_USER_CLOUD_POLICY_MANAGER_H_
#include <memory>
#include "components/policy/core/common/cloud/cloud_policy_manager.h"
#include "services/network/public/cpp/network_connection_tracker.h"
class PrefService;
namespace policy {
class MachineLevelUserCloudPolicyStore;
// Implements a cloud policy manager that initializes the machine level user
// cloud policy.
class POLICY_EXPORT MachineLevelUserCloudPolicyManager
: public CloudPolicyManager {
public:
MachineLevelUserCloudPolicyManager(
std::unique_ptr<MachineLevelUserCloudPolicyStore> store,
std::unique_ptr<CloudExternalDataManager> external_data_manager,
const base::FilePath& policy_dir,
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
network::NetworkConnectionTrackerGetter
network_connection_tracker_getter);
MachineLevelUserCloudPolicyManager(
const MachineLevelUserCloudPolicyManager&) = delete;
MachineLevelUserCloudPolicyManager& operator=(
const MachineLevelUserCloudPolicyManager&) = delete;
~MachineLevelUserCloudPolicyManager() override;
// Initializes the cloud connection. |local_state| must stay valid until this
// object is deleted or DisconnectAndRemovePolicy gets called.
void Connect(PrefService* local_state,
std::unique_ptr<CloudPolicyClient> client);
// Add or remove |observer| to/from the CloudPolicyClient embedded in |core_|.
void AddClientObserver(CloudPolicyClient::Observer* observer);
void RemoveClientObserver(CloudPolicyClient::Observer* observer);
MachineLevelUserCloudPolicyStore* store() { return store_.get(); }
// Shuts down the MachineLevelUserCloudPolicyManager (removes and stops
// refreshing the cached cloud policy).
void DisconnectAndRemovePolicy();
// ConfigurationPolicyProvider:
void Init(SchemaRegistry* registry) override;
void Shutdown() override;
private:
// CloudPolicyStore::Observer:
void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) override;
std::unique_ptr<MachineLevelUserCloudPolicyStore> store_;
std::unique_ptr<CloudExternalDataManager> external_data_manager_;
const base::FilePath policy_dir_;
};
} // namespace policy
#endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_MACHINE_LEVEL_USER_CLOUD_POLICY_MANAGER_H_
|