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 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if (!cache_->is_unmanaged() && | 268 if (!cache_->is_unmanaged() && |
269 !cache_->last_policy_refresh_time().is_null()) { | 269 !cache_->last_policy_refresh_time().is_null()) { |
270 base::TimeDelta timestamp = | 270 base::TimeDelta timestamp = |
271 cache_->last_policy_refresh_time() - base::Time::UnixEpoch(); | 271 cache_->last_policy_refresh_time() - base::Time::UnixEpoch(); |
272 fetch_request->set_timestamp(timestamp.InMilliseconds()); | 272 fetch_request->set_timestamp(timestamp.InMilliseconds()); |
273 } | 273 } |
274 int key_version = 0; | 274 int key_version = 0; |
275 if (cache_->GetPublicKeyVersion(&key_version)) | 275 if (cache_->GetPublicKeyVersion(&key_version)) |
276 fetch_request->set_public_key_version(key_version); | 276 fetch_request->set_public_key_version(key_version); |
277 | 277 |
| 278 #if defined(OS_CHROMEOS) |
278 if (data_store_->device_status_collector()) | 279 if (data_store_->device_status_collector()) |
279 data_store_->device_status_collector()->GetStatus(&device_status); | 280 data_store_->device_status_collector()->GetStatus(&device_status); |
| 281 #endif |
280 | 282 |
281 backend_->ProcessPolicyRequest(data_store_->device_token(), | 283 backend_->ProcessPolicyRequest(data_store_->device_token(), |
282 data_store_->device_id(), | 284 data_store_->device_id(), |
283 data_store_->user_affiliation(), | 285 data_store_->user_affiliation(), |
284 policy_request, &device_status, this); | 286 policy_request, &device_status, this); |
285 } | 287 } |
286 | 288 |
287 void CloudPolicyController::DoWork() { | 289 void CloudPolicyController::DoWork() { |
288 switch (state_) { | 290 switch (state_) { |
289 case STATE_TOKEN_UNAVAILABLE: | 291 case STATE_TOKEN_UNAVAILABLE: |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } | 390 } |
389 | 391 |
390 int64 CloudPolicyController::GetRefreshDelay() { | 392 int64 CloudPolicyController::GetRefreshDelay() { |
391 int64 deviation = (kPolicyRefreshDeviationFactorPercent * | 393 int64 deviation = (kPolicyRefreshDeviationFactorPercent * |
392 policy_refresh_rate_ms_) / 100; | 394 policy_refresh_rate_ms_) / 100; |
393 deviation = std::min(deviation, kPolicyRefreshDeviationMaxInMilliseconds); | 395 deviation = std::min(deviation, kPolicyRefreshDeviationMaxInMilliseconds); |
394 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); | 396 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); |
395 } | 397 } |
396 | 398 |
397 } // namespace policy | 399 } // namespace policy |
OLD | NEW |