Chromium Code Reviews| Index: chrome/browser/policy/device_management_backend_impl.cc |
| diff --git a/chrome/browser/policy/device_management_backend_impl.cc b/chrome/browser/policy/device_management_backend_impl.cc |
| index 5143b21c8cecaf51d30217b743d32121eb3ab7ee..768bfbc79adc891607d662841fe3e96993cf2755 100644 |
| --- a/chrome/browser/policy/device_management_backend_impl.cc |
| +++ b/chrome/browser/policy/device_management_backend_impl.cc |
| @@ -37,6 +37,8 @@ const char DeviceManagementBackendImpl::kParamUserAffiliation[] = |
| // String constants for the device and app type we report to the server. |
| const char DeviceManagementBackendImpl::kValueAppType[] = "Chrome"; |
| const char DeviceManagementBackendImpl::kValueDeviceType[] = "2"; |
| +const char DeviceManagementBackendImpl::kValueRequestAutoEnrollment[] = |
| + "enterprise_check"; |
| const char DeviceManagementBackendImpl::kValueRequestPolicy[] = "policy"; |
| const char DeviceManagementBackendImpl::kValueRequestRegister[] = "register"; |
| const char DeviceManagementBackendImpl::kValueRequestUnregister[] = |
| @@ -457,6 +459,43 @@ class DeviceManagementPolicyJob : public DeviceManagementJobBase { |
| DISALLOW_COPY_AND_ASSIGN(DeviceManagementPolicyJob); |
| }; |
| +// Handles auto enrollment request jobs. These are used to determine if a new |
| +// ChromeOS device should automatically enter the enterprise enrollment screen |
|
Mattias Nissler (ping if slow)
2011/12/05 09:44:15
nit: ChromiumOS
Joao da Silva
2011/12/05 10:00:15
Done.
|
| +// during the OOBE flow. |
| +class DeviceManagementAutoEnrollmentJob : public DeviceManagementJobBase { |
| + public: |
| + DeviceManagementAutoEnrollmentJob( |
| + DeviceManagementBackendImpl* backend_impl, |
| + const std::string& device_id, |
| + const em::DeviceAutoEnrollmentRequest& request, |
| + DeviceManagementBackend::DeviceAutoEnrollmentResponseDelegate* delegate) |
| + : DeviceManagementJobBase( |
| + backend_impl, |
| + DeviceManagementBackendImpl::kValueRequestAutoEnrollment, |
| + device_id), |
| + delegate_(delegate) { |
| + em::DeviceManagementRequest request_wrapper; |
| + request_wrapper.mutable_auto_enrollment_request()->CopyFrom(request); |
| + SetPayload(request_wrapper); |
| + } |
| + virtual ~DeviceManagementAutoEnrollmentJob() {} |
| + |
| + private: |
| + // DeviceManagementJobBase overrides. |
| + virtual void OnError(DeviceManagementBackend::ErrorCode error) OVERRIDE { |
| + delegate_->OnError(error); |
| + } |
| + virtual void OnResponse( |
| + const em::DeviceManagementResponse& response) OVERRIDE { |
| + delegate_->HandleAutoEnrollmentResponse( |
| + response.auto_enrollment_response()); |
| + } |
| + |
| + DeviceManagementBackend::DeviceAutoEnrollmentResponseDelegate* delegate_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DeviceManagementAutoEnrollmentJob); |
| +}; |
| + |
| DeviceManagementBackendImpl::DeviceManagementBackendImpl( |
| DeviceManagementService* service) |
| : service_(service) { |
| @@ -571,6 +610,14 @@ void DeviceManagementBackendImpl::ProcessPolicyRequest( |
| request, delegate)); |
| } |
| +void DeviceManagementBackendImpl::ProcessAutoEnrollmentRequest( |
| + const std::string& device_id, |
| + const em::DeviceAutoEnrollmentRequest& request, |
| + DeviceAutoEnrollmentResponseDelegate* delegate) { |
| + AddJob(new DeviceManagementAutoEnrollmentJob(this, device_id, request, |
| + delegate)); |
| +} |
| + |
| // static |
| const char* DeviceManagementBackendImpl::UserAffiliationToString( |
| CloudPolicyDataStore::UserAffiliation affiliation) { |