| 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/device_management_service.h" | 5 #include "chrome/browser/policy/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 const char kPostContentType[] = "application/protobuf"; | 50 const char kPostContentType[] = "application/protobuf"; |
| 51 | 51 |
| 52 const char kServiceTokenAuthHeader[] = "Authorization: GoogleLogin auth="; | 52 const char kServiceTokenAuthHeader[] = "Authorization: GoogleLogin auth="; |
| 53 const char kDMTokenAuthHeader[] = "Authorization: GoogleDMToken token="; | 53 const char kDMTokenAuthHeader[] = "Authorization: GoogleDMToken token="; |
| 54 | 54 |
| 55 // HTTP Error Codes of the DM Server with their concrete meanings in the context | 55 // HTTP Error Codes of the DM Server with their concrete meanings in the context |
| 56 // of the DM Server communication. | 56 // of the DM Server communication. |
| 57 const int kSuccess = 200; | 57 const int kSuccess = 200; |
| 58 const int kInvalidArgument = 400; | 58 const int kInvalidArgument = 400; |
| 59 const int kInvalidAuthCookieOrDMToken = 401; | 59 const int kInvalidAuthCookieOrDMToken = 401; |
| 60 const int kMissingLicenses = 402; |
| 60 const int kDeviceManagementNotAllowed = 403; | 61 const int kDeviceManagementNotAllowed = 403; |
| 61 const int kInvalidURL = 404; // This error is not coming from the GFE. | 62 const int kInvalidURL = 404; // This error is not coming from the GFE. |
| 62 const int kInvalidSerialNumber = 405; | 63 const int kInvalidSerialNumber = 405; |
| 63 const int kDeviceIdConflict = 409; | 64 const int kDeviceIdConflict = 409; |
| 64 const int kDeviceNotFound = 410; | 65 const int kDeviceNotFound = 410; |
| 65 const int kPendingApproval = 412; | 66 const int kPendingApproval = 412; |
| 66 const int kInternalServerError = 500; | 67 const int kInternalServerError = 500; |
| 67 const int kServiceUnavailable = 503; | 68 const int kServiceUnavailable = 503; |
| 68 const int kPolicyNotFound = 902; // This error is not sent as HTTP status code. | 69 const int kPolicyNotFound = 902; // This error is not sent as HTTP status code. |
| 69 | 70 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 332 } |
| 332 callback_.Run(DM_STATUS_SUCCESS, response); | 333 callback_.Run(DM_STATUS_SUCCESS, response); |
| 333 return; | 334 return; |
| 334 } | 335 } |
| 335 case kInvalidArgument: | 336 case kInvalidArgument: |
| 336 ReportError(DM_STATUS_REQUEST_INVALID); | 337 ReportError(DM_STATUS_REQUEST_INVALID); |
| 337 return; | 338 return; |
| 338 case kInvalidAuthCookieOrDMToken: | 339 case kInvalidAuthCookieOrDMToken: |
| 339 ReportError(DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID); | 340 ReportError(DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID); |
| 340 return; | 341 return; |
| 342 case kMissingLicenses: |
| 343 ReportError(DM_STATUS_MISSING_LICENSES); |
| 344 return; |
| 341 case kDeviceManagementNotAllowed: | 345 case kDeviceManagementNotAllowed: |
| 342 ReportError(DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED); | 346 ReportError(DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED); |
| 343 return; | 347 return; |
| 344 case kPendingApprovalLegacy: | 348 case kPendingApprovalLegacy: |
| 345 case kPendingApproval: | 349 case kPendingApproval: |
| 346 ReportError(DM_STATUS_SERVICE_ACTIVATION_PENDING); | 350 ReportError(DM_STATUS_SERVICE_ACTIVATION_PENDING); |
| 347 return; | 351 return; |
| 348 case kInvalidURL: | 352 case kInvalidURL: |
| 349 case kInternalServerError: | 353 case kInternalServerError: |
| 350 case kServiceUnavailable: | 354 case kServiceUnavailable: |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 589 } |
| 586 } | 590 } |
| 587 | 591 |
| 588 const JobQueue::iterator elem = | 592 const JobQueue::iterator elem = |
| 589 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 593 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
| 590 if (elem != queued_jobs_.end()) | 594 if (elem != queued_jobs_.end()) |
| 591 queued_jobs_.erase(elem); | 595 queued_jobs_.erase(elem); |
| 592 } | 596 } |
| 593 | 597 |
| 594 } // namespace policy | 598 } // namespace policy |
| OLD | NEW |