| 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 "components/policy/core/common/cloud/device_management_service.h" | 5 #include "components/policy/core/common/cloud/device_management_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // HTTP Error Codes of the DM Server with their concrete meanings in the context | 35 // HTTP Error Codes of the DM Server with their concrete meanings in the context |
| 36 // of the DM Server communication. | 36 // of the DM Server communication. |
| 37 const int kSuccess = 200; | 37 const int kSuccess = 200; |
| 38 const int kInvalidArgument = 400; | 38 const int kInvalidArgument = 400; |
| 39 const int kInvalidAuthCookieOrDMToken = 401; | 39 const int kInvalidAuthCookieOrDMToken = 401; |
| 40 const int kMissingLicenses = 402; | 40 const int kMissingLicenses = 402; |
| 41 const int kDeviceManagementNotAllowed = 403; | 41 const int kDeviceManagementNotAllowed = 403; |
| 42 const int kInvalidURL = 404; // This error is not coming from the GFE. | 42 const int kInvalidURL = 404; // This error is not coming from the GFE. |
| 43 const int kInvalidSerialNumber = 405; | 43 const int kInvalidSerialNumber = 405; |
| 44 const int kDomainMismatch = 406; |
| 44 const int kDeviceIdConflict = 409; | 45 const int kDeviceIdConflict = 409; |
| 45 const int kDeviceNotFound = 410; | 46 const int kDeviceNotFound = 410; |
| 46 const int kPendingApproval = 412; | 47 const int kPendingApproval = 412; |
| 47 const int kInternalServerError = 500; | 48 const int kInternalServerError = 500; |
| 48 const int kServiceUnavailable = 503; | 49 const int kServiceUnavailable = 503; |
| 49 const int kPolicyNotFound = 902; | 50 const int kPolicyNotFound = 902; |
| 50 const int kDeprovisioned = 903; | 51 const int kDeprovisioned = 903; |
| 51 | 52 |
| 52 bool IsProxyError(const net::URLRequestStatus status) { | 53 bool IsProxyError(const net::URLRequestStatus status) { |
| 53 switch (status.error()) { | 54 switch (status.error()) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return; | 253 return; |
| 253 case kDeviceNotFound: | 254 case kDeviceNotFound: |
| 254 ReportError(DM_STATUS_SERVICE_DEVICE_NOT_FOUND); | 255 ReportError(DM_STATUS_SERVICE_DEVICE_NOT_FOUND); |
| 255 return; | 256 return; |
| 256 case kPolicyNotFound: | 257 case kPolicyNotFound: |
| 257 ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND); | 258 ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND); |
| 258 return; | 259 return; |
| 259 case kInvalidSerialNumber: | 260 case kInvalidSerialNumber: |
| 260 ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER); | 261 ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER); |
| 261 return; | 262 return; |
| 263 case kDomainMismatch: |
| 264 ReportError(DM_STATUS_SERVICE_DOMAIN_MISMATCH); |
| 265 return; |
| 262 case kDeprovisioned: | 266 case kDeprovisioned: |
| 263 ReportError(DM_STATUS_SERVICE_DEPROVISIONED); | 267 ReportError(DM_STATUS_SERVICE_DEPROVISIONED); |
| 264 return; | 268 return; |
| 265 case kDeviceIdConflict: | 269 case kDeviceIdConflict: |
| 266 ReportError(DM_STATUS_SERVICE_DEVICE_ID_CONFLICT); | 270 ReportError(DM_STATUS_SERVICE_DEVICE_ID_CONFLICT); |
| 267 return; | 271 return; |
| 268 default: | 272 default: |
| 269 // Handle all unknown 5xx HTTP error codes as temporary and any other | 273 // Handle all unknown 5xx HTTP error codes as temporary and any other |
| 270 // unknown error as one that needs more time to recover. | 274 // unknown error as one that needs more time to recover. |
| 271 if (response_code >= 500 && response_code <= 599) | 275 if (response_code >= 500 && response_code <= 599) |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 516 } |
| 513 } | 517 } |
| 514 | 518 |
| 515 const JobQueue::iterator elem = | 519 const JobQueue::iterator elem = |
| 516 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 520 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
| 517 if (elem != queued_jobs_.end()) | 521 if (elem != queued_jobs_.end()) |
| 518 queued_jobs_.erase(elem); | 522 queued_jobs_.erase(elem); |
| 519 } | 523 } |
| 520 | 524 |
| 521 } // namespace policy | 525 } // namespace policy |
| OLD | NEW |