-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
attestation_policy_observer.h
51 lines (38 loc) · 1.81 KB
/
attestation_policy_observer.h
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
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ASH_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_
#define CHROME_BROWSER_ASH_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/ash/settings/cros_settings.h"
#include "chromeos/ash/components/dbus/constants/attestation_constants.h"
namespace ash {
namespace attestation {
class MachineCertificateUploader;
// TODO(b/285556135): Replace this observer with another trigger which starts
// the certificate upload as soon as device policies are available.
// A class which observes policy changes and uploads a certificate if necessary.
class AttestationPolicyObserver {
public:
// The observer immediately connects with CrosSettings to listen for policy
// changes. The CertificateUploader is used to obtain and upload a
// certificate. This class does not take ownership of |certificate_uploader|.
explicit AttestationPolicyObserver(
MachineCertificateUploader* certificate_uploader);
AttestationPolicyObserver(const AttestationPolicyObserver&) = delete;
AttestationPolicyObserver& operator=(const AttestationPolicyObserver&) =
delete;
~AttestationPolicyObserver();
private:
// Called when the attestation setting changes.
void AttestationSettingChanged();
// Checks attestation policy and starts any necessary work.
void Start();
raw_ptr<CrosSettings, ExperimentalAsh> cros_settings_;
raw_ptr<MachineCertificateUploader, ExperimentalAsh> certificate_uploader_;
base::CallbackListSubscription attestation_subscription_;
};
} // namespace attestation
} // namespace ash
#endif // CHROME_BROWSER_ASH_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_