OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ |
7 | 7 |
8 #include <bitset> | 8 #include <bitset> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | |
15 #include "base/macros.h" | 14 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
17 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" | 16 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" |
18 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
19 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
20 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
21 #include "components/policy/core/common/cloud/signing_service.h" | 20 #include "components/policy/core/common/cloud/signing_service.h" |
22 | 21 |
23 class PrefService; | 22 class PrefService; |
24 | 23 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // to be enrolled to as decided by factors such as forced re-enrollment, | 90 // to be enrolled to as decided by factors such as forced re-enrollment, |
92 // enrollment recovery, or already-present install attributes. Note that | 91 // enrollment recovery, or already-present install attributes. Note that |
93 // |config.management_domain| may be non-empty even if |config.mode| is | 92 // |config.management_domain| may be non-empty even if |config.mode| is |
94 // MODE_NONE. | 93 // MODE_NONE. |
95 EnrollmentConfig GetPrescribedEnrollmentConfig() const; | 94 EnrollmentConfig GetPrescribedEnrollmentConfig() const; |
96 | 95 |
97 // CloudPolicyStore::Observer: | 96 // CloudPolicyStore::Observer: |
98 void OnStoreLoaded(CloudPolicyStore* store) override; | 97 void OnStoreLoaded(CloudPolicyStore* store) override; |
99 void OnStoreError(CloudPolicyStore* store) override; | 98 void OnStoreError(CloudPolicyStore* store) override; |
100 | 99 |
101 // Allows testing code to set a signing service tailored to its needs. | |
102 void SetSigningServiceForTesting( | |
103 std::unique_ptr<policy::SigningService> signing_service); | |
104 | |
105 private: | 100 private: |
106 // Signing class implementing the policy::SigningService interface to | 101 // Signing class implemting the policy::SigningService interface to |
107 // sign data using the enrollment certificate's TPM-bound key. | 102 // sign data using the enrollment certificate's TPM-bound key. |
108 class TpmEnrollmentKeySigningService : public policy::SigningService { | 103 class TpmEnrollmentKeySigningService : public policy::SigningService { |
109 public: | 104 public: |
110 TpmEnrollmentKeySigningService( | 105 TpmEnrollmentKeySigningService( |
111 cryptohome::AsyncMethodCaller* async_method_caller); | 106 cryptohome::AsyncMethodCaller* async_method_caller); |
112 ~TpmEnrollmentKeySigningService(); | 107 ~TpmEnrollmentKeySigningService(); |
113 | 108 |
114 void SignData(const std::string& data, | 109 void SignData(const std::string& data, |
115 const SigningCallback& callback) override; | 110 const SigningCallback& callback) override; |
116 | 111 |
(...skipping 29 matching lines...) Expand all Loading... |
146 DeviceCloudPolicyManagerChromeOS* manager_; | 141 DeviceCloudPolicyManagerChromeOS* manager_; |
147 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow_; | 142 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow_; |
148 bool is_initialized_ = false; | 143 bool is_initialized_ = false; |
149 | 144 |
150 // Non-NULL if there is an enrollment operation pending. | 145 // Non-NULL if there is an enrollment operation pending. |
151 std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_; | 146 std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_; |
152 | 147 |
153 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; | 148 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; |
154 | 149 |
155 // Our signing service. | 150 // Our signing service. |
156 std::unique_ptr<SigningService> signing_service_; | 151 TpmEnrollmentKeySigningService signing_service_; |
157 | 152 |
158 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyInitializer); | 153 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyInitializer); |
159 }; | 154 }; |
160 | 155 |
161 } // namespace policy | 156 } // namespace policy |
162 | 157 |
163 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ | 158 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ |
OLD | NEW |