OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/policy/cloud_policy_controller.h" | 5 #include "chrome/browser/policy/cloud_policy_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 base::TimeDelta timestamp = | 250 base::TimeDelta timestamp = |
251 cache_->last_policy_refresh_time() - base::Time::UnixEpoch(); | 251 cache_->last_policy_refresh_time() - base::Time::UnixEpoch(); |
252 fetch_request->set_timestamp(timestamp.InMilliseconds()); | 252 fetch_request->set_timestamp(timestamp.InMilliseconds()); |
253 } | 253 } |
254 int key_version = 0; | 254 int key_version = 0; |
255 if (cache_->GetPublicKeyVersion(&key_version)) | 255 if (cache_->GetPublicKeyVersion(&key_version)) |
256 fetch_request->set_public_key_version(key_version); | 256 fetch_request->set_public_key_version(key_version); |
257 | 257 |
258 backend_->ProcessPolicyRequest(data_store_->device_token(), | 258 backend_->ProcessPolicyRequest(data_store_->device_token(), |
259 data_store_->device_id(), | 259 data_store_->device_id(), |
| 260 data_store_->user_affiliation(), |
260 policy_request, this); | 261 policy_request, this); |
261 } | 262 } |
262 | 263 |
263 void CloudPolicyController::DoWork() { | 264 void CloudPolicyController::DoWork() { |
264 switch (state_) { | 265 switch (state_) { |
265 case STATE_TOKEN_UNAVAILABLE: | 266 case STATE_TOKEN_UNAVAILABLE: |
266 case STATE_TOKEN_ERROR: | 267 case STATE_TOKEN_ERROR: |
267 FetchToken(); | 268 FetchToken(); |
268 return; | 269 return; |
269 case STATE_TOKEN_VALID: | 270 case STATE_TOKEN_VALID: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 360 } |
360 | 361 |
361 int64 CloudPolicyController::GetRefreshDelay() { | 362 int64 CloudPolicyController::GetRefreshDelay() { |
362 int64 deviation = (kPolicyRefreshDeviationFactorPercent * | 363 int64 deviation = (kPolicyRefreshDeviationFactorPercent * |
363 policy_refresh_rate_ms_) / 100; | 364 policy_refresh_rate_ms_) / 100; |
364 deviation = std::min(deviation, kPolicyRefreshDeviationMaxInMilliseconds); | 365 deviation = std::min(deviation, kPolicyRefreshDeviationMaxInMilliseconds); |
365 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); | 366 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); |
366 } | 367 } |
367 | 368 |
368 } // namespace policy | 369 } // namespace policy |
OLD | NEW |