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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const int kDeviceManagementNotAllowed = 403; | 61 const int kDeviceManagementNotAllowed = 403; |
62 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. |
63 const int kInvalidSerialNumber = 405; | 63 const int kInvalidSerialNumber = 405; |
64 const int kDeviceIdConflict = 409; | 64 const int kDeviceIdConflict = 409; |
65 const int kDeviceNotFound = 410; | 65 const int kDeviceNotFound = 410; |
66 const int kPendingApproval = 412; | 66 const int kPendingApproval = 412; |
67 const int kInternalServerError = 500; | 67 const int kInternalServerError = 500; |
68 const int kServiceUnavailable = 503; | 68 const int kServiceUnavailable = 503; |
69 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. |
70 | 70 |
71 // TODO(pastarmovj): Legacy error codes are here for compatibility only. They | |
72 // should be removed once the DM Server has been updated. | |
73 const int kPendingApprovalLegacy = 491; | |
74 const int kDeviceNotFoundLegacy = 901; | |
75 | |
76 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
77 // Machine info keys. | 72 // Machine info keys. |
78 const char kMachineInfoHWClass[] = "hardware_class"; | 73 const char kMachineInfoHWClass[] = "hardware_class"; |
79 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; | 74 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; |
80 #endif | 75 #endif |
81 | 76 |
82 bool IsProxyError(const net::URLRequestStatus status) { | 77 bool IsProxyError(const net::URLRequestStatus status) { |
83 switch (status.error()) { | 78 switch (status.error()) { |
84 case net::ERR_PROXY_CONNECTION_FAILED: | 79 case net::ERR_PROXY_CONNECTION_FAILED: |
85 case net::ERR_TUNNEL_CONNECTION_FAILED: | 80 case net::ERR_TUNNEL_CONNECTION_FAILED: |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 return; | 333 return; |
339 case kInvalidAuthCookieOrDMToken: | 334 case kInvalidAuthCookieOrDMToken: |
340 ReportError(DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID); | 335 ReportError(DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID); |
341 return; | 336 return; |
342 case kMissingLicenses: | 337 case kMissingLicenses: |
343 ReportError(DM_STATUS_MISSING_LICENSES); | 338 ReportError(DM_STATUS_MISSING_LICENSES); |
344 return; | 339 return; |
345 case kDeviceManagementNotAllowed: | 340 case kDeviceManagementNotAllowed: |
346 ReportError(DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED); | 341 ReportError(DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED); |
347 return; | 342 return; |
348 case kPendingApprovalLegacy: | |
349 case kPendingApproval: | 343 case kPendingApproval: |
350 ReportError(DM_STATUS_SERVICE_ACTIVATION_PENDING); | 344 ReportError(DM_STATUS_SERVICE_ACTIVATION_PENDING); |
351 return; | 345 return; |
352 case kInvalidURL: | 346 case kInvalidURL: |
353 case kInternalServerError: | 347 case kInternalServerError: |
354 case kServiceUnavailable: | 348 case kServiceUnavailable: |
355 ReportError(DM_STATUS_TEMPORARY_UNAVAILABLE); | 349 ReportError(DM_STATUS_TEMPORARY_UNAVAILABLE); |
356 return; | 350 return; |
357 case kDeviceNotFoundLegacy: | |
358 case kDeviceNotFound: | 351 case kDeviceNotFound: |
359 ReportError(DM_STATUS_SERVICE_DEVICE_NOT_FOUND); | 352 ReportError(DM_STATUS_SERVICE_DEVICE_NOT_FOUND); |
360 return; | 353 return; |
361 case kPolicyNotFound: | 354 case kPolicyNotFound: |
362 ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND); | 355 ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND); |
363 return; | 356 return; |
364 case kInvalidSerialNumber: | 357 case kInvalidSerialNumber: |
365 ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER); | 358 ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER); |
366 return; | 359 return; |
367 case kDeviceIdConflict: | 360 case kDeviceIdConflict: |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 } | 582 } |
590 } | 583 } |
591 | 584 |
592 const JobQueue::iterator elem = | 585 const JobQueue::iterator elem = |
593 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 586 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
594 if (elem != queued_jobs_.end()) | 587 if (elem != queued_jobs_.end()) |
595 queued_jobs_.erase(elem); | 588 queued_jobs_.erase(elem); |
596 } | 589 } |
597 | 590 |
598 } // namespace policy | 591 } // namespace policy |
OLD | NEW |