| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // state. | 45 // state. |
| 46 // 4. Download the OAuth2 authorization code for device-level API access. | 46 // 4. Download the OAuth2 authorization code for device-level API access. |
| 47 // 5. Download the OAuth2 refresh token for device-level API access and store | 47 // 5. Download the OAuth2 refresh token for device-level API access and store |
| 48 // it. | 48 // it. |
| 49 // 6. Establish the device lock in installation-time attributes. | 49 // 6. Establish the device lock in installation-time attributes. |
| 50 // 7. Store the policy blob and API refresh token. | 50 // 7. Store the policy blob and API refresh token. |
| 51 class EnrollmentHandlerChromeOS : public CloudPolicyClient::Observer, | 51 class EnrollmentHandlerChromeOS : public CloudPolicyClient::Observer, |
| 52 public CloudPolicyStore::Observer, | 52 public CloudPolicyStore::Observer, |
| 53 public gaia::GaiaOAuthClient::Delegate { | 53 public gaia::GaiaOAuthClient::Delegate { |
| 54 public: | 54 public: |
| 55 typedef DeviceCloudPolicyInitializer::AllowedDeviceModes | |
| 56 AllowedDeviceModes; | |
| 57 typedef DeviceCloudPolicyInitializer::EnrollmentCallback | 55 typedef DeviceCloudPolicyInitializer::EnrollmentCallback |
| 58 EnrollmentCallback; | 56 EnrollmentCallback; |
| 59 | 57 |
| 60 // |store| and |install_attributes| must remain valid for the life time of the | 58 // |store| and |install_attributes| must remain valid for the life time of the |
| 61 // enrollment handler. |allowed_device_modes| determines what device modes | 59 // enrollment handler. |
| 62 // are acceptable. If the mode specified by the server is not acceptable, | |
| 63 // enrollment will fail with an EnrollmentStatus indicating | |
| 64 // STATUS_REGISTRATION_BAD_MODE. | |
| 65 EnrollmentHandlerChromeOS( | 60 EnrollmentHandlerChromeOS( |
| 66 DeviceCloudPolicyStoreChromeOS* store, | 61 DeviceCloudPolicyStoreChromeOS* store, |
| 67 EnterpriseInstallAttributes* install_attributes, | 62 EnterpriseInstallAttributes* install_attributes, |
| 68 ServerBackedStateKeysBroker* state_keys_broker, | 63 ServerBackedStateKeysBroker* state_keys_broker, |
| 69 chromeos::attestation::AttestationFlow* attestation_flow, | 64 chromeos::attestation::AttestationFlow* attestation_flow, |
| 70 std::unique_ptr<CloudPolicyClient> client, | 65 std::unique_ptr<CloudPolicyClient> client, |
| 71 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 66 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
| 72 const EnrollmentConfig& enrollment_config, | 67 const EnrollmentConfig& enrollment_config, |
| 73 const std::string& auth_token, | 68 const std::string& auth_token, |
| 74 const std::string& client_id, | 69 const std::string& client_id, |
| 75 const std::string& requisition, | 70 const std::string& requisition, |
| 76 const AllowedDeviceModes& allowed_device_modes, | |
| 77 const EnrollmentCallback& completion_callback); | 71 const EnrollmentCallback& completion_callback); |
| 78 ~EnrollmentHandlerChromeOS() override; | 72 ~EnrollmentHandlerChromeOS() override; |
| 79 | 73 |
| 80 // Starts the enrollment process and reports the result to | 74 // Starts the enrollment process and reports the result to |
| 81 // |completion_callback_|. | 75 // |completion_callback_|. |
| 82 void StartEnrollment(); | 76 void StartEnrollment(); |
| 83 | 77 |
| 84 // Releases the client. | 78 // Releases the client. |
| 85 std::unique_ptr<CloudPolicyClient> ReleaseClient(); | 79 std::unique_ptr<CloudPolicyClient> ReleaseClient(); |
| 86 | 80 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 ServerBackedStateKeysBroker* state_keys_broker_; | 164 ServerBackedStateKeysBroker* state_keys_broker_; |
| 171 chromeos::attestation::AttestationFlow* attestation_flow_; | 165 chromeos::attestation::AttestationFlow* attestation_flow_; |
| 172 std::unique_ptr<CloudPolicyClient> client_; | 166 std::unique_ptr<CloudPolicyClient> client_; |
| 173 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 167 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
| 174 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 168 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
| 175 | 169 |
| 176 EnrollmentConfig enrollment_config_; | 170 EnrollmentConfig enrollment_config_; |
| 177 std::string auth_token_; | 171 std::string auth_token_; |
| 178 std::string client_id_; | 172 std::string client_id_; |
| 179 std::string requisition_; | 173 std::string requisition_; |
| 180 AllowedDeviceModes allowed_device_modes_; | |
| 181 EnrollmentCallback completion_callback_; | 174 EnrollmentCallback completion_callback_; |
| 182 | 175 |
| 183 // The current state key provided by |state_keys_broker_|. | 176 // The current state key provided by |state_keys_broker_|. |
| 184 std::string current_state_key_; | 177 std::string current_state_key_; |
| 185 | 178 |
| 186 // The device mode as received in the registration request. | 179 // The device mode as received in the registration request. |
| 187 DeviceMode device_mode_; | 180 DeviceMode device_mode_; |
| 188 | 181 |
| 189 // Whether the server signaled to skip robot auth setup. | 182 // Whether the server signaled to skip robot auth setup. |
| 190 bool skip_robot_auth_; | 183 bool skip_robot_auth_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 206 int lockbox_init_duration_; | 199 int lockbox_init_duration_; |
| 207 | 200 |
| 208 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 201 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
| 209 | 202 |
| 210 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 203 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
| 211 }; | 204 }; |
| 212 | 205 |
| 213 } // namespace policy | 206 } // namespace policy |
| 214 | 207 |
| 215 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 208 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| OLD | NEW |