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; | |
45 const int kDeviceIdConflict = 409; | 44 const int kDeviceIdConflict = 409; |
46 const int kDeviceNotFound = 410; | 45 const int kDeviceNotFound = 410; |
47 const int kPendingApproval = 412; | 46 const int kPendingApproval = 412; |
48 const int kInternalServerError = 500; | 47 const int kInternalServerError = 500; |
49 const int kServiceUnavailable = 503; | 48 const int kServiceUnavailable = 503; |
50 const int kPolicyNotFound = 902; | 49 const int kPolicyNotFound = 902; |
51 const int kDeprovisioned = 903; | 50 const int kDeprovisioned = 903; |
52 | 51 |
53 bool IsProxyError(const net::URLRequestStatus status) { | 52 bool IsProxyError(const net::URLRequestStatus status) { |
54 switch (status.error()) { | 53 switch (status.error()) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 return; | 252 return; |
254 case kDeviceNotFound: | 253 case kDeviceNotFound: |
255 ReportError(DM_STATUS_SERVICE_DEVICE_NOT_FOUND); | 254 ReportError(DM_STATUS_SERVICE_DEVICE_NOT_FOUND); |
256 return; | 255 return; |
257 case kPolicyNotFound: | 256 case kPolicyNotFound: |
258 ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND); | 257 ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND); |
259 return; | 258 return; |
260 case kInvalidSerialNumber: | 259 case kInvalidSerialNumber: |
261 ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER); | 260 ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER); |
262 return; | 261 return; |
263 case kDomainMismatch: | |
264 ReportError(DM_STATUS_SERVICE_DOMAIN_MISMATCH); | |
265 return; | |
266 case kDeprovisioned: | 262 case kDeprovisioned: |
267 ReportError(DM_STATUS_SERVICE_DEPROVISIONED); | 263 ReportError(DM_STATUS_SERVICE_DEPROVISIONED); |
268 return; | 264 return; |
269 case kDeviceIdConflict: | 265 case kDeviceIdConflict: |
270 ReportError(DM_STATUS_SERVICE_DEVICE_ID_CONFLICT); | 266 ReportError(DM_STATUS_SERVICE_DEVICE_ID_CONFLICT); |
271 return; | 267 return; |
272 default: | 268 default: |
273 // Handle all unknown 5xx HTTP error codes as temporary and any other | 269 // Handle all unknown 5xx HTTP error codes as temporary and any other |
274 // unknown error as one that needs more time to recover. | 270 // unknown error as one that needs more time to recover. |
275 if (response_code >= 500 && response_code <= 599) | 271 if (response_code >= 500 && response_code <= 599) |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 } | 512 } |
517 } | 513 } |
518 | 514 |
519 const JobQueue::iterator elem = | 515 const JobQueue::iterator elem = |
520 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 516 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
521 if (elem != queued_jobs_.end()) | 517 if (elem != queued_jobs_.end()) |
522 queued_jobs_.erase(elem); | 518 queued_jobs_.erase(elem); |
523 } | 519 } |
524 | 520 |
525 } // namespace policy | 521 } // namespace policy |
OLD | NEW |