| 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 "content/browser/download/interrupt_reasons.h" | 5 #include "content/browser/download/download_interrupt_reasons_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace content { |
| 10 |
| 9 #define FILE_ERROR_TO_INTERRUPT_REASON(n, d) \ | 11 #define FILE_ERROR_TO_INTERRUPT_REASON(n, d) \ |
| 10 case net::ERR_##n: return DOWNLOAD_INTERRUPT_REASON_FILE_##d; | 12 case net::ERR_##n: return DOWNLOAD_INTERRUPT_REASON_FILE_##d; |
| 11 | 13 |
| 12 #define NET_ERROR_TO_INTERRUPT_REASON(n, d) \ | 14 #define NET_ERROR_TO_INTERRUPT_REASON(n, d) \ |
| 13 case net::ERR_##n: return DOWNLOAD_INTERRUPT_REASON_NETWORK_##d; | 15 case net::ERR_##n: return DOWNLOAD_INTERRUPT_REASON_NETWORK_##d; |
| 14 | 16 |
| 15 #define SERVER_ERROR_TO_INTERRUPT_REASON(n, d) \ | 17 #define SERVER_ERROR_TO_INTERRUPT_REASON(n, d) \ |
| 16 case net::ERR_##n: return DOWNLOAD_INTERRUPT_REASON_SERVER_##d; | 18 case net::ERR_##n: return DOWNLOAD_INTERRUPT_REASON_SERVER_##d; |
| 17 | 19 |
| 18 InterruptReason ConvertNetErrorToInterruptReason( | 20 DownloadInterruptReason ConvertNetErrorToInterruptReason( |
| 19 net::Error net_error, DownloadInterruptSource source) { | 21 net::Error net_error, DownloadInterruptSource source) { |
| 20 switch (net_error) { | 22 switch (net_error) { |
| 21 // File errors. | 23 // File errors. |
| 22 case net::OK: return DOWNLOAD_INTERRUPT_REASON_NONE; | 24 case net::OK: return DOWNLOAD_INTERRUPT_REASON_NONE; |
| 23 | 25 |
| 24 // The file is too large. | 26 // The file is too large. |
| 25 FILE_ERROR_TO_INTERRUPT_REASON(FILE_TOO_BIG, TOO_LARGE) | 27 FILE_ERROR_TO_INTERRUPT_REASON(FILE_TOO_BIG, TOO_LARGE) |
| 26 | 28 |
| 27 // Permission to access a resource, other than the network, was denied. | 29 // Permission to access a resource, other than the network, was denied. |
| 28 FILE_ERROR_TO_INTERRUPT_REASON(ACCESS_DENIED, ACCESS_DENIED) | 30 FILE_ERROR_TO_INTERRUPT_REASON(ACCESS_DENIED, ACCESS_DENIED) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 83 |
| 82 NOTREACHED(); | 84 NOTREACHED(); |
| 83 | 85 |
| 84 return DOWNLOAD_INTERRUPT_REASON_NONE; | 86 return DOWNLOAD_INTERRUPT_REASON_NONE; |
| 85 } | 87 } |
| 86 | 88 |
| 87 #undef FILE_ERROR_TO_INTERRUPT_REASON | 89 #undef FILE_ERROR_TO_INTERRUPT_REASON |
| 88 #undef NET_ERROR_TO_INTERRUPT_REASON | 90 #undef NET_ERROR_TO_INTERRUPT_REASON |
| 89 #undef SERVER_ERROR_TO_INTERRUPT_REASON | 91 #undef SERVER_ERROR_TO_INTERRUPT_REASON |
| 90 | 92 |
| 91 std::string InterruptReasonDebugString(InterruptReason error) { | 93 std::string InterruptReasonDebugString(DownloadInterruptReason error) { |
| 92 | 94 |
| 93 #define INTERRUPT_REASON(name, value) \ | 95 #define INTERRUPT_REASON(name, value) \ |
| 94 case DOWNLOAD_INTERRUPT_REASON_##name: return #name; | 96 case DOWNLOAD_INTERRUPT_REASON_##name: return #name; |
| 95 | 97 |
| 96 switch (error) { | 98 switch (error) { |
| 97 INTERRUPT_REASON(NONE, 0) | 99 INTERRUPT_REASON(NONE, 0) |
| 98 | 100 |
| 99 #include "content/browser/download/interrupt_reason_values.h" | 101 #include "content/public/browser/download_interrupt_reason_values.h" |
| 100 | 102 |
| 101 default: | 103 default: |
| 102 break; | 104 break; |
| 103 } | 105 } |
| 104 | 106 |
| 105 #undef INTERRUPT_REASON | 107 #undef INTERRUPT_REASON |
| 106 | 108 |
| 107 return "Unknown error"; | 109 return "Unknown error"; |
| 108 } | 110 } |
| 111 |
| 112 } // namespace content |
| OLD | NEW |