| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" | 16 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" |
| 17 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 18 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 19 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 20 #include "components/policy/core/common/cloud/signing_service.h" | 20 #include "components/policy/core/common/cloud/signing_service.h" |
| 21 | 21 |
| 22 class PrefService; | 22 class PrefService; |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class SequencedTaskRunner; | 25 class SequencedTaskRunner; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace chromeos { | 28 namespace chromeos { |
| 29 |
| 30 class InstallAttributes; |
| 31 |
| 29 namespace attestation { | 32 namespace attestation { |
| 30 class AttestationFlow; | 33 class AttestationFlow; |
| 31 } | 34 } |
| 32 } | 35 } |
| 33 | 36 |
| 34 namespace cryptohome { | 37 namespace cryptohome { |
| 35 class AsyncMethodCaller; | 38 class AsyncMethodCaller; |
| 36 } | 39 } |
| 37 | 40 |
| 38 namespace policy { | 41 namespace policy { |
| 39 | 42 |
| 40 class DeviceCloudPolicyManagerChromeOS; | 43 class DeviceCloudPolicyManagerChromeOS; |
| 41 class DeviceCloudPolicyStoreChromeOS; | 44 class DeviceCloudPolicyStoreChromeOS; |
| 42 class DeviceManagementService; | 45 class DeviceManagementService; |
| 43 struct EnrollmentConfig; | 46 struct EnrollmentConfig; |
| 44 class EnrollmentHandlerChromeOS; | 47 class EnrollmentHandlerChromeOS; |
| 45 class EnrollmentStatus; | 48 class EnrollmentStatus; |
| 46 class EnterpriseInstallAttributes; | |
| 47 | 49 |
| 48 // This class connects DCPM to the correct device management service, and | 50 // This class connects DCPM to the correct device management service, and |
| 49 // handles the enrollment process. | 51 // handles the enrollment process. |
| 50 class DeviceCloudPolicyInitializer : public CloudPolicyStore::Observer { | 52 class DeviceCloudPolicyInitializer : public CloudPolicyStore::Observer { |
| 51 public: | 53 public: |
| 52 typedef base::Callback<void(EnrollmentStatus)> EnrollmentCallback; | 54 typedef base::Callback<void(EnrollmentStatus)> EnrollmentCallback; |
| 53 | 55 |
| 54 // |background_task_runner| is used to execute long-running background tasks | 56 // |background_task_runner| is used to execute long-running background tasks |
| 55 // that may involve file I/O. | 57 // that may involve file I/O. |
| 56 DeviceCloudPolicyInitializer( | 58 DeviceCloudPolicyInitializer( |
| 57 PrefService* local_state, | 59 PrefService* local_state, |
| 58 DeviceManagementService* enterprise_service, | 60 DeviceManagementService* enterprise_service, |
| 59 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, | 61 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
| 60 EnterpriseInstallAttributes* install_attributes, | 62 chromeos::InstallAttributes* install_attributes, |
| 61 ServerBackedStateKeysBroker* state_keys_broker, | 63 ServerBackedStateKeysBroker* state_keys_broker, |
| 62 DeviceCloudPolicyStoreChromeOS* device_store, | 64 DeviceCloudPolicyStoreChromeOS* device_store, |
| 63 DeviceCloudPolicyManagerChromeOS* manager, | 65 DeviceCloudPolicyManagerChromeOS* manager, |
| 64 cryptohome::AsyncMethodCaller* async_method_caller, | 66 cryptohome::AsyncMethodCaller* async_method_caller, |
| 65 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow); | 67 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow); |
| 66 | 68 |
| 67 ~DeviceCloudPolicyInitializer() override; | 69 ~DeviceCloudPolicyInitializer() override; |
| 68 | 70 |
| 69 virtual void Init(); | 71 virtual void Init(); |
| 70 virtual void Shutdown(); | 72 virtual void Shutdown(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Creates a new CloudPolicyClient. | 130 // Creates a new CloudPolicyClient. |
| 129 std::unique_ptr<CloudPolicyClient> CreateClient( | 131 std::unique_ptr<CloudPolicyClient> CreateClient( |
| 130 DeviceManagementService* device_management_service); | 132 DeviceManagementService* device_management_service); |
| 131 | 133 |
| 132 void TryToCreateClient(); | 134 void TryToCreateClient(); |
| 133 void StartConnection(std::unique_ptr<CloudPolicyClient> client); | 135 void StartConnection(std::unique_ptr<CloudPolicyClient> client); |
| 134 | 136 |
| 135 PrefService* local_state_; | 137 PrefService* local_state_; |
| 136 DeviceManagementService* enterprise_service_; | 138 DeviceManagementService* enterprise_service_; |
| 137 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 139 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
| 138 EnterpriseInstallAttributes* install_attributes_; | 140 chromeos::InstallAttributes* install_attributes_; |
| 139 ServerBackedStateKeysBroker* state_keys_broker_; | 141 ServerBackedStateKeysBroker* state_keys_broker_; |
| 140 DeviceCloudPolicyStoreChromeOS* device_store_; | 142 DeviceCloudPolicyStoreChromeOS* device_store_; |
| 141 DeviceCloudPolicyManagerChromeOS* manager_; | 143 DeviceCloudPolicyManagerChromeOS* manager_; |
| 142 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow_; | 144 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow_; |
| 143 bool is_initialized_ = false; | 145 bool is_initialized_ = false; |
| 144 | 146 |
| 145 // Non-NULL if there is an enrollment operation pending. | 147 // Non-NULL if there is an enrollment operation pending. |
| 146 std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_; | 148 std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_; |
| 147 | 149 |
| 148 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; | 150 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; |
| 149 | 151 |
| 150 // Our signing service. | 152 // Our signing service. |
| 151 std::unique_ptr<SigningService> signing_service_; | 153 std::unique_ptr<SigningService> signing_service_; |
| 152 | 154 |
| 153 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyInitializer); | 155 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyInitializer); |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 } // namespace policy | 158 } // namespace policy |
| 157 | 159 |
| 158 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ | 160 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ |
| OLD | NEW |