OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ENROLLMENT_HANDLER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 // 5. Download the OAuth2 refresh token for device-level API access and store | 51 // 5. Download the OAuth2 refresh token for device-level API access and store |
52 // it. | 52 // it. |
53 // 6. Establish the device lock in installation-time attributes. | 53 // 6. Establish the device lock in installation-time attributes. |
54 // 7. Store the policy blob and API refresh token. | 54 // 7. Store the policy blob and API refresh token. |
55 class EnrollmentHandlerChromeOS : public CloudPolicyClient::Observer, | 55 class EnrollmentHandlerChromeOS : public CloudPolicyClient::Observer, |
56 public CloudPolicyStore::Observer, | 56 public CloudPolicyStore::Observer, |
57 public gaia::GaiaOAuthClient::Delegate { | 57 public gaia::GaiaOAuthClient::Delegate { |
58 public: | 58 public: |
59 typedef DeviceCloudPolicyInitializer::EnrollmentCallback | 59 typedef DeviceCloudPolicyInitializer::EnrollmentCallback |
60 EnrollmentCallback; | 60 EnrollmentCallback; |
61 typedef DeviceCloudPolicyInitializer::AvailableLicensesCallback | |
achuithb
2017/07/31 21:03:23
We prefer using, and switch EnrollmentCallback as
Denis Kuznetsov (DE-MUC)
2017/08/01 10:50:54
Done.
| |
62 AvailableLicensesCallback; | |
61 | 63 |
62 // |store| and |install_attributes| must remain valid for the life time of the | 64 // |store| and |install_attributes| must remain valid for the life time of the |
63 // enrollment handler. | 65 // enrollment handler. |
64 EnrollmentHandlerChromeOS( | 66 EnrollmentHandlerChromeOS( |
65 DeviceCloudPolicyStoreChromeOS* store, | 67 DeviceCloudPolicyStoreChromeOS* store, |
66 chromeos::InstallAttributes* install_attributes, | 68 chromeos::InstallAttributes* install_attributes, |
67 ServerBackedStateKeysBroker* state_keys_broker, | 69 ServerBackedStateKeysBroker* state_keys_broker, |
68 chromeos::attestation::AttestationFlow* attestation_flow, | 70 chromeos::attestation::AttestationFlow* attestation_flow, |
69 std::unique_ptr<CloudPolicyClient> client, | 71 std::unique_ptr<CloudPolicyClient> client, |
70 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 72 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
71 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate, | 73 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate, |
72 const EnrollmentConfig& enrollment_config, | 74 const EnrollmentConfig& enrollment_config, |
73 const std::string& auth_token, | 75 const std::string& auth_token, |
74 const std::string& client_id, | 76 const std::string& client_id, |
75 const std::string& requisition, | 77 const std::string& requisition, |
76 const EnrollmentCallback& completion_callback); | 78 const EnrollmentCallback& completion_callback); |
77 ~EnrollmentHandlerChromeOS() override; | 79 ~EnrollmentHandlerChromeOS() override; |
78 | 80 |
81 // Checks license types available for enrollment and reports the result | |
82 // to |callback|. | |
83 void CheckAvailableLicenses( | |
84 const AvailableLicensesCallback& completion_callback); | |
85 | |
79 // Starts the enrollment process and reports the result to | 86 // Starts the enrollment process and reports the result to |
80 // |completion_callback_|. | 87 // |completion_callback_|. |
81 void StartEnrollment(); | 88 void StartEnrollment(); |
82 | 89 |
90 // Starts the enrollment process using user-selected |license_type| | |
91 // and reports the result to |completion_callback_|. | |
92 void StartEnrollmentWithLicense(LicenseType license_type); | |
93 | |
83 // Releases the client. | 94 // Releases the client. |
84 std::unique_ptr<CloudPolicyClient> ReleaseClient(); | 95 std::unique_ptr<CloudPolicyClient> ReleaseClient(); |
85 | 96 |
86 // CloudPolicyClient::Observer: | 97 // CloudPolicyClient::Observer: |
87 void OnPolicyFetched(CloudPolicyClient* client) override; | 98 void OnPolicyFetched(CloudPolicyClient* client) override; |
88 void OnRegistrationStateChanged(CloudPolicyClient* client) override; | 99 void OnRegistrationStateChanged(CloudPolicyClient* client) override; |
89 void OnRobotAuthCodesFetched(CloudPolicyClient* client) override; | 100 void OnRobotAuthCodesFetched(CloudPolicyClient* client) override; |
90 void OnClientError(CloudPolicyClient* client) override; | 101 void OnClientError(CloudPolicyClient* client) override; |
91 | 102 |
92 // CloudPolicyStore::Observer: | 103 // CloudPolicyStore::Observer: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 | 174 |
164 // Calls InstallAttributes::LockDevice() for enterprise enrollment and | 175 // Calls InstallAttributes::LockDevice() for enterprise enrollment and |
165 // DeviceSettingsService::SetManagementSettings() for consumer | 176 // DeviceSettingsService::SetManagementSettings() for consumer |
166 // enrollment. | 177 // enrollment. |
167 void StartLockDevice(); | 178 void StartLockDevice(); |
168 | 179 |
169 // Handle callback from InstallAttributes::LockDevice() and retry on failure. | 180 // Handle callback from InstallAttributes::LockDevice() and retry on failure. |
170 void HandleLockDeviceResult( | 181 void HandleLockDeviceResult( |
171 chromeos::InstallAttributes::LockResult lock_result); | 182 chromeos::InstallAttributes::LockResult lock_result); |
172 | 183 |
184 // Handles the available licenses request. | |
185 void HandleAvailableLicensesResult( | |
186 bool success, | |
187 const policy::CloudPolicyClient::LicenseMap& license_map); | |
188 | |
173 // Initiates storing DM token. For Active Directory devices only. | 189 // Initiates storing DM token. For Active Directory devices only. |
174 void StartStoreDMToken(); | 190 void StartStoreDMToken(); |
175 | 191 |
176 // Called after StartStoreDMtoken() is done. | 192 // Called after StartStoreDMtoken() is done. |
177 void HandleDMTokenStoreResult(bool success); | 193 void HandleDMTokenStoreResult(bool success); |
178 | 194 |
179 // Initiates storing of robot auth token. | 195 // Initiates storing of robot auth token. |
180 void StartStoreRobotAuth(); | 196 void StartStoreRobotAuth(); |
181 | 197 |
182 // Handles completion of the robot token store operation. | 198 // Handles completion of the robot token store operation. |
(...skipping 19 matching lines...) Expand all Loading... | |
202 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 218 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
203 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate_ = nullptr; | 219 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate_ = nullptr; |
204 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 220 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
205 std::unique_ptr<policy::DMTokenStorage> dm_token_storage_; | 221 std::unique_ptr<policy::DMTokenStorage> dm_token_storage_; |
206 | 222 |
207 EnrollmentConfig enrollment_config_; | 223 EnrollmentConfig enrollment_config_; |
208 std::string auth_token_; | 224 std::string auth_token_; |
209 std::string client_id_; | 225 std::string client_id_; |
210 std::string requisition_; | 226 std::string requisition_; |
211 EnrollmentCallback completion_callback_; | 227 EnrollmentCallback completion_callback_; |
228 AvailableLicensesCallback available_licenses_callback_; | |
229 enterprise_management::LicenseType::LicenseTypeEnum license_type_; | |
achuithb
2017/07/31 21:03:23
Initialize this here
Denis Kuznetsov (DE-MUC)
2017/08/01 10:50:54
Done.
| |
212 | 230 |
213 // The current state key provided by |state_keys_broker_|. | 231 // The current state key provided by |state_keys_broker_|. |
214 std::string current_state_key_; | 232 std::string current_state_key_; |
215 | 233 |
216 // The device mode as received in the registration request. | 234 // The device mode as received in the registration request. |
217 DeviceMode device_mode_ = DEVICE_MODE_NOT_SET; | 235 DeviceMode device_mode_ = DEVICE_MODE_NOT_SET; |
218 | 236 |
219 // Whether the server signaled to skip robot auth setup. | 237 // Whether the server signaled to skip robot auth setup. |
220 bool skip_robot_auth_ = false; | 238 bool skip_robot_auth_ = false; |
221 | 239 |
(...skipping 14 matching lines...) Expand all Loading... | |
236 int lockbox_init_duration_ = 0; | 254 int lockbox_init_duration_ = 0; |
237 | 255 |
238 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 256 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
239 | 257 |
240 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 258 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
241 }; | 259 }; |
242 | 260 |
243 } // namespace policy | 261 } // namespace policy |
244 | 262 |
245 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 263 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
OLD | NEW |