| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
| 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" | 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" |
| 17 #include "chrome/browser/chromeos/policy/enrollment_config.h" | 17 #include "chrome/browser/chromeos/policy/enrollment_config.h" |
| 18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 19 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 21 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 21 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 22 #include "google_apis/gaia/gaia_oauth_client.h" | 22 #include "google_apis/gaia/gaia_oauth_client.h" |
| 23 #include "policy/proto/device_management_backend.pb.h" | 23 #include "policy/proto/device_management_backend.pb.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class SequencedTaskRunner; | 26 class SequencedTaskRunner; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace chromeos { | |
| 30 class OwnerSettingsServiceChromeOS; | |
| 31 } | |
| 32 | |
| 33 namespace policy { | 29 namespace policy { |
| 34 | 30 |
| 35 class DeviceCloudPolicyStoreChromeOS; | 31 class DeviceCloudPolicyStoreChromeOS; |
| 36 class ServerBackedStateKeysBroker; | 32 class ServerBackedStateKeysBroker; |
| 37 | 33 |
| 38 // Implements the logic that establishes enterprise enrollment for Chromium OS | 34 // Implements the logic that establishes enterprise enrollment for Chromium OS |
| 39 // devices. The process is as follows: | 35 // devices. The process is as follows: |
| 40 // 1. Given an auth token, register with the policy service. | 36 // 1. Given an auth token, register with the policy service. |
| 41 // 2. Download the initial policy blob from the service. | 37 // 2. Download the initial policy blob from the service. |
| 42 // 3. Verify the policy blob. Everything up to this point doesn't touch device | 38 // 3. Verify the policy blob. Everything up to this point doesn't touch device |
| (...skipping 10 matching lines...) Expand all Loading... |
| 53 typedef DeviceCloudPolicyInitializer::AllowedDeviceModes | 49 typedef DeviceCloudPolicyInitializer::AllowedDeviceModes |
| 54 AllowedDeviceModes; | 50 AllowedDeviceModes; |
| 55 typedef DeviceCloudPolicyInitializer::EnrollmentCallback | 51 typedef DeviceCloudPolicyInitializer::EnrollmentCallback |
| 56 EnrollmentCallback; | 52 EnrollmentCallback; |
| 57 | 53 |
| 58 // |store| and |install_attributes| must remain valid for the life time of the | 54 // |store| and |install_attributes| must remain valid for the life time of the |
| 59 // enrollment handler. |allowed_device_modes| determines what device modes | 55 // enrollment handler. |allowed_device_modes| determines what device modes |
| 60 // are acceptable. If the mode specified by the server is not acceptable, | 56 // are acceptable. If the mode specified by the server is not acceptable, |
| 61 // enrollment will fail with an EnrollmentStatus indicating | 57 // enrollment will fail with an EnrollmentStatus indicating |
| 62 // STATUS_REGISTRATION_BAD_MODE. | 58 // STATUS_REGISTRATION_BAD_MODE. |
| 63 // |management_mode| should be either ENTERPRISE_MANAGED or CONSUMER_MANAGED. | |
| 64 EnrollmentHandlerChromeOS( | 59 EnrollmentHandlerChromeOS( |
| 65 DeviceCloudPolicyStoreChromeOS* store, | 60 DeviceCloudPolicyStoreChromeOS* store, |
| 66 EnterpriseInstallAttributes* install_attributes, | 61 EnterpriseInstallAttributes* install_attributes, |
| 67 ServerBackedStateKeysBroker* state_keys_broker, | 62 ServerBackedStateKeysBroker* state_keys_broker, |
| 68 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service, | |
| 69 std::unique_ptr<CloudPolicyClient> client, | 63 std::unique_ptr<CloudPolicyClient> client, |
| 70 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 64 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
| 71 const EnrollmentConfig& enrollment_config, | 65 const EnrollmentConfig& enrollment_config, |
| 72 const std::string& auth_token, | 66 const std::string& auth_token, |
| 73 const std::string& client_id, | 67 const std::string& client_id, |
| 74 const std::string& requisition, | 68 const std::string& requisition, |
| 75 const AllowedDeviceModes& allowed_device_modes, | 69 const AllowedDeviceModes& allowed_device_modes, |
| 76 ManagementMode management_mode, | |
| 77 const EnrollmentCallback& completion_callback); | 70 const EnrollmentCallback& completion_callback); |
| 78 ~EnrollmentHandlerChromeOS() override; | 71 ~EnrollmentHandlerChromeOS() override; |
| 79 | 72 |
| 80 // Starts the enrollment process and reports the result to | 73 // Starts the enrollment process and reports the result to |
| 81 // |completion_callback_|. | 74 // |completion_callback_|. |
| 82 void StartEnrollment(); | 75 void StartEnrollment(); |
| 83 | 76 |
| 84 // Releases the client. | 77 // Releases the client. |
| 85 std::unique_ptr<CloudPolicyClient> ReleaseClient(); | 78 std::unique_ptr<CloudPolicyClient> ReleaseClient(); |
| 86 | 79 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 146 |
| 154 // Drops any ongoing actions. | 147 // Drops any ongoing actions. |
| 155 void Stop(); | 148 void Stop(); |
| 156 | 149 |
| 157 // Reports the result of the enrollment process to the initiator. | 150 // Reports the result of the enrollment process to the initiator. |
| 158 void ReportResult(EnrollmentStatus status); | 151 void ReportResult(EnrollmentStatus status); |
| 159 | 152 |
| 160 DeviceCloudPolicyStoreChromeOS* store_; | 153 DeviceCloudPolicyStoreChromeOS* store_; |
| 161 EnterpriseInstallAttributes* install_attributes_; | 154 EnterpriseInstallAttributes* install_attributes_; |
| 162 ServerBackedStateKeysBroker* state_keys_broker_; | 155 ServerBackedStateKeysBroker* state_keys_broker_; |
| 163 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service_; | |
| 164 std::unique_ptr<CloudPolicyClient> client_; | 156 std::unique_ptr<CloudPolicyClient> client_; |
| 165 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 157 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
| 166 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 158 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
| 167 | 159 |
| 168 EnrollmentConfig enrollment_config_; | 160 EnrollmentConfig enrollment_config_; |
| 169 std::string auth_token_; | 161 std::string auth_token_; |
| 170 std::string client_id_; | 162 std::string client_id_; |
| 171 std::string requisition_; | 163 std::string requisition_; |
| 172 AllowedDeviceModes allowed_device_modes_; | 164 AllowedDeviceModes allowed_device_modes_; |
| 173 ManagementMode management_mode_; | |
| 174 EnrollmentCallback completion_callback_; | 165 EnrollmentCallback completion_callback_; |
| 175 | 166 |
| 176 // The current state key provided by |state_keys_broker_|. | 167 // The current state key provided by |state_keys_broker_|. |
| 177 std::string current_state_key_; | 168 std::string current_state_key_; |
| 178 | 169 |
| 179 // The device mode as received in the registration request. | 170 // The device mode as received in the registration request. |
| 180 DeviceMode device_mode_; | 171 DeviceMode device_mode_; |
| 181 | 172 |
| 182 // Whether the server signaled to skip robot auth setup. | 173 // Whether the server signaled to skip robot auth setup. |
| 183 bool skip_robot_auth_; | 174 bool skip_robot_auth_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 199 int lockbox_init_duration_; | 190 int lockbox_init_duration_; |
| 200 | 191 |
| 201 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 192 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
| 202 | 193 |
| 203 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 194 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
| 204 }; | 195 }; |
| 205 | 196 |
| 206 } // namespace policy | 197 } // namespace policy |
| 207 | 198 |
| 208 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 199 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| OLD | NEW |