OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/shell/domain_socket/net_errors.h" | 5 #include "shell/domain_socket/net_errors.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 #endif | 11 #endif |
12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
13 #include <winsock2.h> | 13 #include <winsock2.h> |
14 #define EDQUOT WSAEDQUOT | 14 #define EDQUOT WSAEDQUOT |
15 #define EHOSTDOWN WSAEHOSTDOWN | 15 #define EHOSTDOWN WSAEHOSTDOWN |
(...skipping 10 matching lines...) Expand all Loading... |
26 namespace shell { | 26 namespace shell { |
27 namespace net { | 27 namespace net { |
28 | 28 |
29 std::string ErrorToString(int error) { | 29 std::string ErrorToString(int error) { |
30 if (error == 0) | 30 if (error == 0) |
31 return "OK"; | 31 return "OK"; |
32 | 32 |
33 const char* error_string; | 33 const char* error_string; |
34 switch (error) { | 34 switch (error) { |
35 #define NET_ERROR(label, value) \ | 35 #define NET_ERROR(label, value) \ |
36 case ERR_ ## label: \ | 36 case ERR_##label: \ |
37 error_string = # label; \ | 37 error_string = #label; \ |
38 break; | 38 break; |
39 #include "mojo/shell/domain_socket/net_error_list.h" | 39 #include "shell/domain_socket/net_error_list.h" |
40 #undef NET_ERROR | 40 #undef NET_ERROR |
41 default: | 41 default: |
42 NOTREACHED(); | 42 NOTREACHED(); |
43 error_string = "<unknown>"; | 43 error_string = "<unknown>"; |
44 } | 44 } |
45 return std::string("ERR_") + error_string; | 45 return std::string("ERR_") + error_string; |
46 } | 46 } |
47 | 47 |
48 Error FileErrorToNetError(base::File::Error file_error) { | 48 Error FileErrorToNetError(base::File::Error file_error) { |
49 switch (file_error) { | 49 switch (file_error) { |
50 case base::File::FILE_OK: | 50 case base::File::FILE_OK: |
51 return net::OK; | 51 return net::OK; |
52 case base::File::FILE_ERROR_ACCESS_DENIED: | 52 case base::File::FILE_ERROR_ACCESS_DENIED: |
53 return net::ERR_ACCESS_DENIED; | 53 return net::ERR_ACCESS_DENIED; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 default: | 159 default: |
160 LOG(WARNING) << "Unknown error " << os_error | 160 LOG(WARNING) << "Unknown error " << os_error |
161 << " mapped to net::ERR_FAILED"; | 161 << " mapped to net::ERR_FAILED"; |
162 return ERR_FAILED; | 162 return ERR_FAILED; |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 } // namespace net | 166 } // namespace net |
167 } // namespace shell | 167 } // namespace shell |
168 } // namespace mojo | 168 } // namespace mojo |
OLD | NEW |