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..445971a4ccacfec39fd8cae205c5a384c4b4a554 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,40 @@ class DeviceManagementPolicyJob : public DeviceManagementJobBase { |
| DISALLOW_COPY_AND_ASSIGN(DeviceManagementPolicyJob); |
| }; |
| +class DeviceManagementAutoEnrollmentJob : public DeviceManagementJobBase { |
|
pastarmovj
2011/12/01 09:30:04
A short comment for the class will be good althoug
Joao da Silva
2011/12/01 09:42:07
Done.
|
| + 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 { |
|
pastarmovj
2011/12/01 09:30:04
Don't you want to put some UMA metrics here as wel
Joao da Silva
2011/12/01 09:42:07
Yes, we want metrics on how auto-enrollment behave
pastarmovj
2011/12/01 09:49:03
Good.
|
| + 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 +607,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) { |