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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 // state. | 49 // state. |
50 // 4. Download the OAuth2 authorization code for device-level API access. | 50 // 4. Download the OAuth2 authorization code for device-level API access. |
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 using EnrollmentCallback = DeviceCloudPolicyInitializer::EnrollmentCallback; |
60 EnrollmentCallback; | 60 using AvailableLicensesCallback = |
61 DeviceCloudPolicyInitializer::AvailableLicensesCallback; | |
61 | 62 |
62 // |store| and |install_attributes| must remain valid for the life time of the | 63 // |store| and |install_attributes| must remain valid for the life time of the |
63 // enrollment handler. | 64 // enrollment handler. |
64 EnrollmentHandlerChromeOS( | 65 EnrollmentHandlerChromeOS( |
65 DeviceCloudPolicyStoreChromeOS* store, | 66 DeviceCloudPolicyStoreChromeOS* store, |
66 chromeos::InstallAttributes* install_attributes, | 67 chromeos::InstallAttributes* install_attributes, |
67 ServerBackedStateKeysBroker* state_keys_broker, | 68 ServerBackedStateKeysBroker* state_keys_broker, |
68 chromeos::attestation::AttestationFlow* attestation_flow, | 69 chromeos::attestation::AttestationFlow* attestation_flow, |
69 std::unique_ptr<CloudPolicyClient> client, | 70 std::unique_ptr<CloudPolicyClient> client, |
70 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 71 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
71 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate, | 72 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate, |
72 const EnrollmentConfig& enrollment_config, | 73 const EnrollmentConfig& enrollment_config, |
73 const std::string& auth_token, | 74 const std::string& auth_token, |
74 const std::string& client_id, | 75 const std::string& client_id, |
75 const std::string& requisition, | 76 const std::string& requisition, |
76 const EnrollmentCallback& completion_callback); | 77 const EnrollmentCallback& completion_callback); |
77 ~EnrollmentHandlerChromeOS() override; | 78 ~EnrollmentHandlerChromeOS() override; |
78 | 79 |
80 // Checks license types available for enrollment and reports the result | |
81 // to |callback|. | |
82 void CheckAvailableLicenses( | |
83 const AvailableLicensesCallback& completion_callback); | |
84 | |
79 // Starts the enrollment process and reports the result to | 85 // Starts the enrollment process and reports the result to |
80 // |completion_callback_|. | 86 // |completion_callback_|. |
81 void StartEnrollment(); | 87 void StartEnrollment(); |
82 | 88 |
89 // Starts the enrollment process using user-selected |license_type| | |
90 // and reports the result to |completion_callback_|. | |
91 void StartEnrollmentWithLicense(LicenseType license_type); | |
92 | |
83 // Releases the client. | 93 // Releases the client. |
84 std::unique_ptr<CloudPolicyClient> ReleaseClient(); | 94 std::unique_ptr<CloudPolicyClient> ReleaseClient(); |
85 | 95 |
86 // CloudPolicyClient::Observer: | 96 // CloudPolicyClient::Observer: |
87 void OnPolicyFetched(CloudPolicyClient* client) override; | 97 void OnPolicyFetched(CloudPolicyClient* client) override; |
88 void OnRegistrationStateChanged(CloudPolicyClient* client) override; | 98 void OnRegistrationStateChanged(CloudPolicyClient* client) override; |
89 void OnRobotAuthCodesFetched(CloudPolicyClient* client) override; | 99 void OnRobotAuthCodesFetched(CloudPolicyClient* client) override; |
90 void OnClientError(CloudPolicyClient* client) override; | 100 void OnClientError(CloudPolicyClient* client) override; |
91 | 101 |
92 // CloudPolicyStore::Observer: | 102 // CloudPolicyStore::Observer: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 | 173 |
164 // Calls InstallAttributes::LockDevice() for enterprise enrollment and | 174 // Calls InstallAttributes::LockDevice() for enterprise enrollment and |
165 // DeviceSettingsService::SetManagementSettings() for consumer | 175 // DeviceSettingsService::SetManagementSettings() for consumer |
166 // enrollment. | 176 // enrollment. |
167 void StartLockDevice(); | 177 void StartLockDevice(); |
168 | 178 |
169 // Handle callback from InstallAttributes::LockDevice() and retry on failure. | 179 // Handle callback from InstallAttributes::LockDevice() and retry on failure. |
170 void HandleLockDeviceResult( | 180 void HandleLockDeviceResult( |
171 chromeos::InstallAttributes::LockResult lock_result); | 181 chromeos::InstallAttributes::LockResult lock_result); |
172 | 182 |
183 // Handles the available licenses request. | |
184 void HandleAvailableLicensesResult( | |
185 bool success, | |
186 const policy::CloudPolicyClient::LicenseMap& license_map); | |
emaxx
2017/08/03 18:31:50
nit: s/policy:://
(sorry for spotting this only no
Denis Kuznetsov (DE-MUC)
2017/08/03 20:08:17
Done here and in other places.
| |
187 | |
173 // Initiates storing DM token. For Active Directory devices only. | 188 // Initiates storing DM token. For Active Directory devices only. |
174 void StartStoreDMToken(); | 189 void StartStoreDMToken(); |
175 | 190 |
176 // Called after StartStoreDMtoken() is done. | 191 // Called after StartStoreDMtoken() is done. |
177 void HandleDMTokenStoreResult(bool success); | 192 void HandleDMTokenStoreResult(bool success); |
178 | 193 |
179 // Initiates storing of robot auth token. | 194 // Initiates storing of robot auth token. |
180 void StartStoreRobotAuth(); | 195 void StartStoreRobotAuth(); |
181 | 196 |
182 // Handles completion of the robot token store operation. | 197 // Handles completion of the robot token store operation. |
(...skipping 19 matching lines...) Expand all Loading... | |
202 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 217 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
203 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate_ = nullptr; | 218 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate_ = nullptr; |
204 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 219 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
205 std::unique_ptr<policy::DMTokenStorage> dm_token_storage_; | 220 std::unique_ptr<policy::DMTokenStorage> dm_token_storage_; |
206 | 221 |
207 EnrollmentConfig enrollment_config_; | 222 EnrollmentConfig enrollment_config_; |
208 std::string auth_token_; | 223 std::string auth_token_; |
209 std::string client_id_; | 224 std::string client_id_; |
210 std::string requisition_; | 225 std::string requisition_; |
211 EnrollmentCallback completion_callback_; | 226 EnrollmentCallback completion_callback_; |
227 AvailableLicensesCallback available_licenses_callback_; | |
228 enterprise_management::LicenseType::LicenseTypeEnum license_type_ = | |
229 enterprise_management::LicenseType::UNDEFINED; | |
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 |