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> | |
9 #include <memory> | 8 #include <memory> |
10 #include <string> | 9 #include <string> |
11 | 10 |
12 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
13 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | 13 #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" |
(...skipping 24 matching lines...) Expand all Loading... |
43 class DeviceManagementService; | 42 class DeviceManagementService; |
44 struct EnrollmentConfig; | 43 struct EnrollmentConfig; |
45 class EnrollmentHandlerChromeOS; | 44 class EnrollmentHandlerChromeOS; |
46 class EnrollmentStatus; | 45 class EnrollmentStatus; |
47 class EnterpriseInstallAttributes; | 46 class EnterpriseInstallAttributes; |
48 | 47 |
49 // This class connects DCPM to the correct device management service, and | 48 // This class connects DCPM to the correct device management service, and |
50 // handles the enrollment process. | 49 // handles the enrollment process. |
51 class DeviceCloudPolicyInitializer : public CloudPolicyStore::Observer { | 50 class DeviceCloudPolicyInitializer : public CloudPolicyStore::Observer { |
52 public: | 51 public: |
53 typedef std::bitset<32> AllowedDeviceModes; | |
54 typedef base::Callback<void(EnrollmentStatus)> EnrollmentCallback; | 52 typedef base::Callback<void(EnrollmentStatus)> EnrollmentCallback; |
55 | 53 |
56 // |background_task_runner| is used to execute long-running background tasks | 54 // |background_task_runner| is used to execute long-running background tasks |
57 // that may involve file I/O. | 55 // that may involve file I/O. |
58 DeviceCloudPolicyInitializer( | 56 DeviceCloudPolicyInitializer( |
59 PrefService* local_state, | 57 PrefService* local_state, |
60 DeviceManagementService* enterprise_service, | 58 DeviceManagementService* enterprise_service, |
61 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, | 59 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
62 EnterpriseInstallAttributes* install_attributes, | 60 EnterpriseInstallAttributes* install_attributes, |
63 ServerBackedStateKeysBroker* state_keys_broker, | 61 ServerBackedStateKeysBroker* state_keys_broker, |
64 DeviceCloudPolicyStoreChromeOS* device_store, | 62 DeviceCloudPolicyStoreChromeOS* device_store, |
65 DeviceCloudPolicyManagerChromeOS* manager, | 63 DeviceCloudPolicyManagerChromeOS* manager, |
66 cryptohome::AsyncMethodCaller* async_method_caller, | 64 cryptohome::AsyncMethodCaller* async_method_caller, |
67 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow); | 65 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow); |
68 | 66 |
69 ~DeviceCloudPolicyInitializer() override; | 67 ~DeviceCloudPolicyInitializer() override; |
70 | 68 |
71 virtual void Init(); | 69 virtual void Init(); |
72 virtual void Shutdown(); | 70 virtual void Shutdown(); |
73 | 71 |
74 // Starts enrollment or re-enrollment. Once the enrollment process completes, | 72 // Starts enrollment or re-enrollment. Once the enrollment process completes, |
75 // |enrollment_callback| is invoked and gets passed the status of the | 73 // |enrollment_callback| is invoked and gets passed the status of the |
76 // operation. | 74 // operation. |
77 // |allowed_modes| specifies acceptable DEVICE_MODE_* constants for | |
78 // enrollment. | |
79 virtual void StartEnrollment( | 75 virtual void StartEnrollment( |
80 DeviceManagementService* device_management_service, | 76 DeviceManagementService* device_management_service, |
81 const EnrollmentConfig& enrollment_config, | 77 const EnrollmentConfig& enrollment_config, |
82 const std::string& auth_token, | 78 const std::string& auth_token, |
83 const AllowedDeviceModes& allowed_modes, | |
84 const EnrollmentCallback& enrollment_callback); | 79 const EnrollmentCallback& enrollment_callback); |
85 | 80 |
86 // Get the enrollment configuration that has been set up via signals such as | 81 // Get the enrollment configuration that has been set up via signals such as |
87 // device requisition, OEM manifest, pre-existing installation-time attributes | 82 // device requisition, OEM manifest, pre-existing installation-time attributes |
88 // or server-backed state retrieval. The configuration is stored in |config|, | 83 // or server-backed state retrieval. The configuration is stored in |config|, |
89 // |config.mode| will be MODE_NONE if there is no prescribed configuration. | 84 // |config.mode| will be MODE_NONE if there is no prescribed configuration. |
90 // |config.management_domain| will contain the domain the device is supposed | 85 // |config.management_domain| will contain the domain the device is supposed |
91 // to be enrolled to as decided by factors such as forced re-enrollment, | 86 // to be enrolled to as decided by factors such as forced re-enrollment, |
92 // enrollment recovery, or already-present install attributes. Note that | 87 // enrollment recovery, or already-present install attributes. Note that |
93 // |config.management_domain| may be non-empty even if |config.mode| is | 88 // |config.management_domain| may be non-empty even if |config.mode| is |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 149 |
155 // Our signing service. | 150 // Our signing service. |
156 std::unique_ptr<SigningService> signing_service_; | 151 std::unique_ptr<SigningService> 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 |