| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.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/enterprise_install_attributes.h" | 17 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 18 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 19 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 20 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 21 #include "google_apis/gaia/gaia_oauth_client.h" | 21 #include "google_apis/gaia/gaia_oauth_client.h" |
| 22 #include "policy/proto/device_management_backend.pb.h" | 22 #include "policy/proto/device_management_backend.pb.h" |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class SequencedTaskRunner; | 25 class SequencedTaskRunner; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace chromeos { | 28 namespace chromeos { |
| 29 class DeviceSettingsService; | 29 class DeviceSettingsService; |
| 30 class OwnerSettingsServiceChromeOS; |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace policy { | 33 namespace policy { |
| 33 | 34 |
| 34 class DeviceCloudPolicyStoreChromeOS; | 35 class DeviceCloudPolicyStoreChromeOS; |
| 35 class ServerBackedStateKeysBroker; | 36 class ServerBackedStateKeysBroker; |
| 36 | 37 |
| 37 // Implements the logic that establishes enterprise enrollment for Chromium OS | 38 // Implements the logic that establishes enterprise enrollment for Chromium OS |
| 38 // devices. The process is as follows: | 39 // devices. The process is as follows: |
| 39 // 1. Given an auth token, register with the policy service. | 40 // 1. Given an auth token, register with the policy service. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 58 // enrollment handler. |allowed_device_modes| determines what device modes | 59 // enrollment handler. |allowed_device_modes| determines what device modes |
| 59 // are acceptable. If the mode specified by the server is not acceptable, | 60 // are acceptable. If the mode specified by the server is not acceptable, |
| 60 // enrollment will fail with an EnrollmentStatus indicating | 61 // enrollment will fail with an EnrollmentStatus indicating |
| 61 // STATUS_REGISTRATION_BAD_MODE. | 62 // STATUS_REGISTRATION_BAD_MODE. |
| 62 // |management_mode| should be either ENTERPRISE_MANAGED or CONSUMER_MANAGED. | 63 // |management_mode| should be either ENTERPRISE_MANAGED or CONSUMER_MANAGED. |
| 63 EnrollmentHandlerChromeOS( | 64 EnrollmentHandlerChromeOS( |
| 64 DeviceCloudPolicyStoreChromeOS* store, | 65 DeviceCloudPolicyStoreChromeOS* store, |
| 65 EnterpriseInstallAttributes* install_attributes, | 66 EnterpriseInstallAttributes* install_attributes, |
| 66 ServerBackedStateKeysBroker* state_keys_broker, | 67 ServerBackedStateKeysBroker* state_keys_broker, |
| 67 chromeos::DeviceSettingsService* device_settings_service, | 68 chromeos::DeviceSettingsService* device_settings_service, |
| 69 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service, |
| 68 scoped_ptr<CloudPolicyClient> client, | 70 scoped_ptr<CloudPolicyClient> client, |
| 69 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 71 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
| 70 const std::string& auth_token, | 72 const std::string& auth_token, |
| 71 const std::string& client_id, | 73 const std::string& client_id, |
| 72 bool is_auto_enrollment, | 74 bool is_auto_enrollment, |
| 73 const std::string& requisition, | 75 const std::string& requisition, |
| 74 const AllowedDeviceModes& allowed_device_modes, | 76 const AllowedDeviceModes& allowed_device_modes, |
| 75 ManagementMode management_mode, | 77 ManagementMode management_mode, |
| 76 const EnrollmentCallback& completion_callback); | 78 const EnrollmentCallback& completion_callback); |
| 77 virtual ~EnrollmentHandlerChromeOS(); | 79 virtual ~EnrollmentHandlerChromeOS(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 131 |
| 130 // Handles the policy validation result, proceeding with device lock if | 132 // Handles the policy validation result, proceeding with device lock if |
| 131 // successful. | 133 // successful. |
| 132 void HandlePolicyValidationResult(DeviceCloudPolicyValidator* validator); | 134 void HandlePolicyValidationResult(DeviceCloudPolicyValidator* validator); |
| 133 | 135 |
| 134 // Calls InstallAttributes::LockDevice() for enterprise enrollment and | 136 // Calls InstallAttributes::LockDevice() for enterprise enrollment and |
| 135 // DeviceSettingsService::SetManagementSettings() for consumer | 137 // DeviceSettingsService::SetManagementSettings() for consumer |
| 136 // enrollment. | 138 // enrollment. |
| 137 void StartLockDevice(); | 139 void StartLockDevice(); |
| 138 | 140 |
| 139 // Checks the status after SetManagementSettings() is done. Proceeds to | 141 // Called after SetManagementSettings() is done. Proceeds to robot |
| 140 // robot auth code storing if successful. | 142 // auth code storing if successful. |
| 141 void HandleSetManagementSettingsDone(); | 143 void HandleSetManagementSettingsDone(bool success); |
| 142 | 144 |
| 143 // Handle callback from InstallAttributes::LockDevice() and retry on failure. | 145 // Handle callback from InstallAttributes::LockDevice() and retry on failure. |
| 144 void HandleLockDeviceResult( | 146 void HandleLockDeviceResult( |
| 145 EnterpriseInstallAttributes::LockResult lock_result); | 147 EnterpriseInstallAttributes::LockResult lock_result); |
| 146 | 148 |
| 147 // Initiates storing of robot auth token. | 149 // Initiates storing of robot auth token. |
| 148 void StartStoreRobotAuth(); | 150 void StartStoreRobotAuth(); |
| 149 | 151 |
| 150 // Handles completion of the robot token store operation. | 152 // Handles completion of the robot token store operation. |
| 151 void HandleStoreRobotAuthTokenResult(bool result); | 153 void HandleStoreRobotAuthTokenResult(bool result); |
| 152 | 154 |
| 153 // Drops any ongoing actions. | 155 // Drops any ongoing actions. |
| 154 void Stop(); | 156 void Stop(); |
| 155 | 157 |
| 156 // Reports the result of the enrollment process to the initiator. | 158 // Reports the result of the enrollment process to the initiator. |
| 157 void ReportResult(EnrollmentStatus status); | 159 void ReportResult(EnrollmentStatus status); |
| 158 | 160 |
| 159 DeviceCloudPolicyStoreChromeOS* store_; | 161 DeviceCloudPolicyStoreChromeOS* store_; |
| 160 EnterpriseInstallAttributes* install_attributes_; | 162 EnterpriseInstallAttributes* install_attributes_; |
| 161 ServerBackedStateKeysBroker* state_keys_broker_; | 163 ServerBackedStateKeysBroker* state_keys_broker_; |
| 162 chromeos::DeviceSettingsService* device_settings_service_; | 164 chromeos::DeviceSettingsService* device_settings_service_; |
| 165 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service_; |
| 163 scoped_ptr<CloudPolicyClient> client_; | 166 scoped_ptr<CloudPolicyClient> client_; |
| 164 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 167 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
| 165 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 168 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
| 166 | 169 |
| 167 std::string auth_token_; | 170 std::string auth_token_; |
| 168 std::string client_id_; | 171 std::string client_id_; |
| 169 bool is_auto_enrollment_; | 172 bool is_auto_enrollment_; |
| 170 std::string requisition_; | 173 std::string requisition_; |
| 171 std::string current_state_key_; | 174 std::string current_state_key_; |
| 172 std::string refresh_token_; | 175 std::string refresh_token_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 191 int lockbox_init_duration_; | 194 int lockbox_init_duration_; |
| 192 | 195 |
| 193 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 196 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
| 194 | 197 |
| 195 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 198 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
| 196 }; | 199 }; |
| 197 | 200 |
| 198 } // namespace policy | 201 } // namespace policy |
| 199 | 202 |
| 200 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 203 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| OLD | NEW |