| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_refresh_scheduler.h" | 5 #include "chrome/browser/policy/cloud_policy_refresh_scheduler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/task_runner.h" | 9 #include "base/task_runner.h" |
| 10 #include "chrome/browser/policy/cloud_policy_constants.h" | 10 #include "chrome/browser/policy/cloud_policy_constants.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 case DM_STATUS_REQUEST_INVALID: | 150 case DM_STATUS_REQUEST_INVALID: |
| 151 case DM_STATUS_HTTP_STATUS_ERROR: | 151 case DM_STATUS_HTTP_STATUS_ERROR: |
| 152 case DM_STATUS_RESPONSE_DECODING_ERROR: | 152 case DM_STATUS_RESPONSE_DECODING_ERROR: |
| 153 case DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: | 153 case DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: |
| 154 RefreshAfter(kUnmanagedRefreshDelayMs); | 154 RefreshAfter(kUnmanagedRefreshDelayMs); |
| 155 return; | 155 return; |
| 156 case DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID: | 156 case DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID: |
| 157 case DM_STATUS_SERVICE_DEVICE_NOT_FOUND: | 157 case DM_STATUS_SERVICE_DEVICE_NOT_FOUND: |
| 158 case DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER: | 158 case DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER: |
| 159 case DM_STATUS_SERVICE_DEVICE_ID_CONFLICT: | 159 case DM_STATUS_SERVICE_DEVICE_ID_CONFLICT: |
| 160 case DM_STATUS_MISSING_LICENSES: |
| 160 // Need a re-registration, no use in retrying. | 161 // Need a re-registration, no use in retrying. |
| 161 return; | 162 return; |
| 162 } | 163 } |
| 163 | 164 |
| 164 NOTREACHED() << "Invalid client status " << client_->status(); | 165 NOTREACHED() << "Invalid client status " << client_->status(); |
| 165 RefreshAfter(kUnmanagedRefreshDelayMs); | 166 RefreshAfter(kUnmanagedRefreshDelayMs); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void CloudPolicyRefreshScheduler::PerformRefresh() { | 169 void CloudPolicyRefreshScheduler::PerformRefresh() { |
| 169 if (client_->is_registered()) { | 170 if (client_->is_registered()) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 195 task_runner_->PostDelayedTask(FROM_HERE, refresh_callback_.callback(), delay); | 196 task_runner_->PostDelayedTask(FROM_HERE, refresh_callback_.callback(), delay); |
| 196 } | 197 } |
| 197 | 198 |
| 198 int64 CloudPolicyRefreshScheduler::GetRefreshDelay() { | 199 int64 CloudPolicyRefreshScheduler::GetRefreshDelay() { |
| 199 return std::min(std::max<int64>(refresh_delay_.GetValue(), | 200 return std::min(std::max<int64>(refresh_delay_.GetValue(), |
| 200 kRefreshDelayMinMs), | 201 kRefreshDelayMinMs), |
| 201 kRefreshDelayMaxMs); | 202 kRefreshDelayMaxMs); |
| 202 } | 203 } |
| 203 | 204 |
| 204 } // namespace policy | 205 } // namespace policy |
| OLD | NEW |