| 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_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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 case DM_STATUS_REQUEST_INVALID: | 88 case DM_STATUS_REQUEST_INVALID: |
| 89 case DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID: | 89 case DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID: |
| 90 sample = kMetricPolicyFetchRequestFailed; | 90 sample = kMetricPolicyFetchRequestFailed; |
| 91 break; | 91 break; |
| 92 case DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: | 92 case DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: |
| 93 case DM_STATUS_SERVICE_DEVICE_ID_CONFLICT: | 93 case DM_STATUS_SERVICE_DEVICE_ID_CONFLICT: |
| 94 case DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER: | 94 case DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER: |
| 95 case DM_STATUS_TEMPORARY_UNAVAILABLE: | 95 case DM_STATUS_TEMPORARY_UNAVAILABLE: |
| 96 case DM_STATUS_SERVICE_ACTIVATION_PENDING: | 96 case DM_STATUS_SERVICE_ACTIVATION_PENDING: |
| 97 case DM_STATUS_HTTP_STATUS_ERROR: | 97 case DM_STATUS_HTTP_STATUS_ERROR: |
| 98 case DM_STATUS_MISSING_LICENSES: |
| 98 sample = kMetricPolicyFetchServerFailed; | 99 sample = kMetricPolicyFetchServerFailed; |
| 99 break; | 100 break; |
| 100 } | 101 } |
| 101 if (sample != -1) | 102 if (sample != -1) |
| 102 UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, sample, kMetricPolicySize); | 103 UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, sample, kMetricPolicySize); |
| 103 else | 104 else |
| 104 NOTREACHED(); | 105 NOTREACHED(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace | 108 } // namespace |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 LOG(WARNING) << "The device token was either invalid or unknown to the " | 212 LOG(WARNING) << "The device token was either invalid or unknown to the " |
| 212 << "device manager, re-registering device."; | 213 << "device manager, re-registering device."; |
| 213 // Will retry fetching a token but gracefully backing off. | 214 // Will retry fetching a token but gracefully backing off. |
| 214 SetState(STATE_TOKEN_ERROR); | 215 SetState(STATE_TOKEN_ERROR); |
| 215 return; | 216 return; |
| 216 case DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER: | 217 case DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER: |
| 217 VLOG(1) << "The device is no longer enlisted for the domain."; | 218 VLOG(1) << "The device is no longer enlisted for the domain."; |
| 218 token_fetcher_->SetSerialNumberInvalidState(); | 219 token_fetcher_->SetSerialNumberInvalidState(); |
| 219 SetState(STATE_TOKEN_ERROR); | 220 SetState(STATE_TOKEN_ERROR); |
| 220 return; | 221 return; |
| 222 case DM_STATUS_MISSING_LICENSES: |
| 223 VLOG(1) << "There are no valid licenses for this domain left."; |
| 224 token_fetcher_->SetMissingLicensesState(); |
| 225 SetState(STATE_TOKEN_UNMANAGED); |
| 226 return; |
| 221 case DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: | 227 case DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: |
| 222 VLOG(1) << "The device is no longer managed."; | 228 VLOG(1) << "The device is no longer managed."; |
| 223 token_fetcher_->SetUnmanagedState(); | 229 token_fetcher_->SetUnmanagedState(); |
| 224 SetState(STATE_TOKEN_UNMANAGED); | 230 SetState(STATE_TOKEN_UNMANAGED); |
| 225 return; | 231 return; |
| 226 case DM_STATUS_SERVICE_POLICY_NOT_FOUND: | 232 case DM_STATUS_SERVICE_POLICY_NOT_FOUND: |
| 227 case DM_STATUS_REQUEST_INVALID: | 233 case DM_STATUS_REQUEST_INVALID: |
| 228 case DM_STATUS_SERVICE_ACTIVATION_PENDING: | 234 case DM_STATUS_SERVICE_ACTIVATION_PENDING: |
| 229 case DM_STATUS_RESPONSE_DECODING_ERROR: | 235 case DM_STATUS_RESPONSE_DECODING_ERROR: |
| 230 case DM_STATUS_HTTP_STATUS_ERROR: | 236 case DM_STATUS_HTTP_STATUS_ERROR: |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 496 |
| 491 base::Time CloudPolicyController::GetLastRefreshTime(const base::Time& now) { | 497 base::Time CloudPolicyController::GetLastRefreshTime(const base::Time& now) { |
| 492 base::Time last_refresh(cache_->last_policy_refresh_time()); | 498 base::Time last_refresh(cache_->last_policy_refresh_time()); |
| 493 if (last_refresh.is_null()) | 499 if (last_refresh.is_null()) |
| 494 last_refresh = now; | 500 last_refresh = now; |
| 495 | 501 |
| 496 return last_refresh; | 502 return last_refresh; |
| 497 } | 503 } |
| 498 | 504 |
| 499 } // namespace policy | 505 } // namespace policy |
| OLD | NEW |