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