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 #ifndef NET_BASE_NET_ERRORS_H__ | 5 #ifndef NET_BASE_NET_ERRORS_H__ |
6 #define NET_BASE_NET_ERRORS_H__ | 6 #define NET_BASE_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 #include "base/logging.h" |
13 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 // Error domain of the net module's error codes. | 18 // Error domain of the net module's error codes. |
18 NET_EXPORT extern const char kErrorDomain[]; | 19 NET_EXPORT extern const char kErrorDomain[]; |
19 | 20 |
20 // Error values are negative. | 21 // Error values are negative. |
21 enum Error { | 22 enum Error { |
22 // No error. | 23 // No error. |
(...skipping 15 matching lines...) Expand all Loading... |
38 | 39 |
39 // Returns true if |error| is a certificate error code. | 40 // Returns true if |error| is a certificate error code. |
40 NET_EXPORT bool IsCertificateError(int error); | 41 NET_EXPORT bool IsCertificateError(int error); |
41 | 42 |
42 // Returns true if |error| is a client certificate authentication error. This | 43 // Returns true if |error| is a client certificate authentication error. This |
43 // does not include ERR_SSL_PROTOCOL_ERROR which may also signal a bad client | 44 // does not include ERR_SSL_PROTOCOL_ERROR which may also signal a bad client |
44 // certificate. | 45 // certificate. |
45 NET_EXPORT bool IsClientCertificateError(int error); | 46 NET_EXPORT bool IsClientCertificateError(int error); |
46 | 47 |
47 // Map system error code to Error. | 48 // Map system error code to Error. |
48 NET_EXPORT Error MapSystemError(int os_error); | 49 NET_EXPORT Error MapSystemError(logging::SystemErrorCode os_error); |
49 | 50 |
50 // Returns a list of all the possible net error codes (not counting OK). This | 51 // Returns a list of all the possible net error codes (not counting OK). This |
51 // is intended for use with UMA histograms that are reporting the result of | 52 // is intended for use with UMA histograms that are reporting the result of |
52 // an action that is represented as a net error code. | 53 // an action that is represented as a net error code. |
53 // | 54 // |
54 // Note that the error codes are all positive (since histograms expect positive | 55 // Note that the error codes are all positive (since histograms expect positive |
55 // sample values). Also note that a guard bucket is created after any valid | 56 // sample values). Also note that a guard bucket is created after any valid |
56 // error code that is not followed immediately by a valid error code. | 57 // error code that is not followed immediately by a valid error code. |
57 NET_EXPORT std::vector<int> GetAllErrorCodesForUma(); | 58 NET_EXPORT std::vector<int> GetAllErrorCodesForUma(); |
58 | 59 |
59 // A convenient function to translate file error to net error code. | 60 // A convenient function to translate file error to net error code. |
60 NET_EXPORT Error FileErrorToNetError(base::File::Error file_error); | 61 NET_EXPORT Error FileErrorToNetError(base::File::Error file_error); |
61 | 62 |
62 } // namespace net | 63 } // namespace net |
63 | 64 |
64 #endif // NET_BASE_NET_ERRORS_H__ | 65 #endif // NET_BASE_NET_ERRORS_H__ |
OLD | NEW |