Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Unified Diff: chrome/browser/policy/cloud_policy_client.cc

Issue 12209070: Fix cloud policy duplicate registrations issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/policy/cloud_policy_client.h ('k') | chrome/browser/policy/device_management_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « chrome/browser/policy/cloud_policy_client.h ('k') | chrome/browser/policy/device_management_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698