| 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( |
| 103 std::unique_ptr<policy::SigningService> signing_service); |
| 104 |
| 100 private: | 105 private: |
| 101 // Signing class implemting the policy::SigningService interface to | 106 // Signing class implementing the policy::SigningService interface to |
| 102 // sign data using the enrollment certificate's TPM-bound key. | 107 // sign data using the enrollment certificate's TPM-bound key. |
| 103 class TpmEnrollmentKeySigningService : public policy::SigningService { | 108 class TpmEnrollmentKeySigningService : public policy::SigningService { |
| 104 public: | 109 public: |
| 105 TpmEnrollmentKeySigningService( | 110 TpmEnrollmentKeySigningService( |
| 106 cryptohome::AsyncMethodCaller* async_method_caller); | 111 cryptohome::AsyncMethodCaller* async_method_caller); |
| 107 ~TpmEnrollmentKeySigningService(); | 112 ~TpmEnrollmentKeySigningService(); |
| 108 | 113 |
| 109 void SignData(const std::string& data, | 114 void SignData(const std::string& data, |
| 110 const SigningCallback& callback) override; | 115 const SigningCallback& callback) override; |
| 111 | 116 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 141 DeviceCloudPolicyManagerChromeOS* manager_; | 146 DeviceCloudPolicyManagerChromeOS* manager_; |
| 142 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow_; | 147 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow_; |
| 143 bool is_initialized_ = false; | 148 bool is_initialized_ = false; |
| 144 | 149 |
| 145 // Non-NULL if there is an enrollment operation pending. | 150 // Non-NULL if there is an enrollment operation pending. |
| 146 std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_; | 151 std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_; |
| 147 | 152 |
| 148 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; | 153 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; |
| 149 | 154 |
| 150 // Our signing service. | 155 // Our signing service. |
| 151 TpmEnrollmentKeySigningService signing_service_; | 156 std::unique_ptr<SigningService> signing_service_; |
| 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 |