Chromium Code Reviews| Index: chrome/browser/policy/cloud_policy_client.cc |
| diff --git a/chrome/browser/policy/cloud_policy_client.cc b/chrome/browser/policy/cloud_policy_client.cc |
| index 16a3db635b73d3f7d5429ba5502525b945e0d7c1..32b1885cede3f10764c5c7c6247ec8d6aa57f83d 100644 |
| --- a/chrome/browser/policy/cloud_policy_client.cc |
| +++ b/chrome/browser/policy/cloud_policy_client.cc |
| @@ -110,6 +110,9 @@ void CloudPolicyClient::Register(em::DeviceRegisterRequest::Type type, |
| if (is_auto_enrollement) |
| request->set_auto_enrolled(true); |
| + request_job_->SetRetryCallback( |
| + base::Bind(&CloudPolicyClient::OnRetryRegister, base::Unretained(this))); |
| + |
| request_job_->Start(base::Bind(&CloudPolicyClient::OnRegisterCompleted, |
| base::Unretained(this))); |
| } |
| @@ -201,6 +204,16 @@ const em::PolicyFetchResponse* CloudPolicyClient::GetPolicyFor( |
| return it == responses_.end() ? NULL : it->second; |
| } |
| +void CloudPolicyClient::OnRetryRegister(DeviceManagementRequestJob* job) { |
| + DCHECK_EQ(request_job_.get(), job); |
| + // If the initial request managed to get to the server but the response didn't |
| + // arrive to the client then retrying with the same device-id will fail. |
|
Mattias Nissler (ping if slow)
2013/02/11 11:30:37
nit: s/to/at/
Mattias Nissler (ping if slow)
2013/02/11 11:30:37
nit: s/device-id/client ID/ (for consistency with
Joao da Silva
2013/02/11 17:38:19
Done.
Joao da Silva
2013/02/11 17:38:19
Done.
|
| + // Set the re-registration flag so that the server accepts it. |
| + // If the server hasn't seen the device-id before then it will also accept |
|
Mattias Nissler (ping if slow)
2013/02/11 11:30:37
ditto
Joao da Silva
2013/02/11 17:38:19
Done.
|
| + // the re-registration. |
| + job->GetRequest()->mutable_register_request()->set_reregister(true); |
| +} |
| + |
| void CloudPolicyClient::OnRegisterCompleted( |
| DeviceManagementStatus status, |
| const em::DeviceManagementResponse& response) { |