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 #ifndef MOJO_SHELL_DOMAIN_SOCKET_NET_ERRORS_H__ | 5 #ifndef SHELL_DOMAIN_SOCKET_NET_ERRORS_H__ |
6 #define MOJO_SHELL_DOMAIN_SOCKET_NET_ERRORS_H__ | 6 #define SHELL_DOMAIN_SOCKET_NET_ERRORS_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 namespace shell { | 15 namespace shell { |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 // Error values are negative. | 18 // Error values are negative. |
19 enum Error { | 19 enum Error { |
20 // No error. | 20 // No error. |
21 OK = 0, | 21 OK = 0, |
22 | 22 |
23 #define NET_ERROR(label, value) ERR_ ## label = value, | 23 #define NET_ERROR(label, value) ERR_##label = value, |
24 #include "mojo/shell/domain_socket/net_error_list.h" | 24 #include "shell/domain_socket/net_error_list.h" |
25 #undef NET_ERROR | 25 #undef NET_ERROR |
26 | 26 |
27 }; | 27 }; |
28 | 28 |
29 // Returns a textual representation of the error code for logging purposes. | 29 // Returns a textual representation of the error code for logging purposes. |
30 std::string ErrorToString(int error); | 30 std::string ErrorToString(int error); |
31 | 31 |
32 // A convenient function to translate file error to net error code. | 32 // A convenient function to translate file error to net error code. |
33 Error FileErrorToNetError(base::File::Error file_error); | 33 Error FileErrorToNetError(base::File::Error file_error); |
34 | 34 |
35 // Map system error code to Error. | 35 // Map system error code to Error. |
36 Error MapSystemError(int os_error); | 36 Error MapSystemError(int os_error); |
37 | 37 |
38 } // namespace net | 38 } // namespace net |
39 } // namespace shell | 39 } // namespace shell |
40 } // namespace mojo | 40 } // namespace mojo |
41 | 41 |
42 #endif // MOJO_SHELL_DOMAIN_SOCKET_NET_ERRORS_H__ | 42 #endif // SHELL_DOMAIN_SOCKET_NET_ERRORS_H__ |
OLD | NEW |