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

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

Issue 10628008: If there is a device id use that instead of a new one for re-enrolling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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/browser_policy_connector.cc ('k') | chrome/browser/policy/cloud_policy_data_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/cloud_policy_controller.cc
diff --git a/chrome/browser/policy/cloud_policy_controller.cc b/chrome/browser/policy/cloud_policy_controller.cc
index 4eb9a7f9e35f2c798f5bf35ea3a13fa45192ed61..95d71fe67f6357af7324cccaab13616fd0d41e2d 100644
--- a/chrome/browser/policy/cloud_policy_controller.cc
+++ b/chrome/browser/policy/cloud_policy_controller.cc
@@ -246,10 +246,14 @@ void CloudPolicyController::OnPolicyFetchCompleted(
}
void CloudPolicyController::OnDeviceTokenChanged() {
- if (data_store_->device_token().empty())
+ if (data_store_->device_token().empty()) {
+ // Additionally clear the generated device id to ensure we don't reuse old
+ // ids which could be potentially used for user tracking.
+ data_store_->set_device_id(std::string());
SetState(STATE_TOKEN_UNAVAILABLE);
- else
+ } else {
SetState(STATE_TOKEN_VALID);
+ }
}
void CloudPolicyController::OnCredentialsChanged() {
@@ -317,9 +321,10 @@ bool CloudPolicyController::ReadyToFetchToken() {
void CloudPolicyController::FetchToken() {
if (ReadyToFetchToken()) {
if (CanBeInManagedDomain(data_store_->user_name())) {
- // Generate a new random device id. (It'll only be kept if registration
- // succeeds.)
- data_store_->set_device_id(base::GenerateGUID());
+ // Either use an already prepopulated id or generate a new random device
+ // id. (It'll only be kept if registration succeeds.)
+ if (data_store_->device_id().empty())
+ data_store_->set_device_id(base::GenerateGUID());
token_fetcher_->FetchToken();
} else {
SetState(STATE_TOKEN_UNMANAGED);
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/browser/policy/cloud_policy_data_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698