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(), | |
261 policy_request, this); | 260 policy_request, this); |
262 } | 261 } |
263 | 262 |
264 void CloudPolicyController::DoWork() { | 263 void CloudPolicyController::DoWork() { |
265 switch (state_) { | 264 switch (state_) { |
266 case STATE_TOKEN_UNAVAILABLE: | 265 case STATE_TOKEN_UNAVAILABLE: |
267 case STATE_TOKEN_ERROR: | 266 case STATE_TOKEN_ERROR: |
268 FetchToken(); | 267 FetchToken(); |
269 return; | 268 return; |
270 case STATE_TOKEN_VALID: | 269 case STATE_TOKEN_VALID: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 359 } |
361 | 360 |
362 int64 CloudPolicyController::GetRefreshDelay() { | 361 int64 CloudPolicyController::GetRefreshDelay() { |
363 int64 deviation = (kPolicyRefreshDeviationFactorPercent * | 362 int64 deviation = (kPolicyRefreshDeviationFactorPercent * |
364 policy_refresh_rate_ms_) / 100; | 363 policy_refresh_rate_ms_) / 100; |
365 deviation = std::min(deviation, kPolicyRefreshDeviationMaxInMilliseconds); | 364 deviation = std::min(deviation, kPolicyRefreshDeviationMaxInMilliseconds); |
366 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); | 365 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); |
367 } | 366 } |
368 | 367 |
369 } // namespace policy | 368 } // namespace policy |
OLD | NEW |