OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <vector> |
| 10 |
9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
10 | 12 |
11 namespace net { | 13 namespace net { |
12 | 14 |
13 // Error domain of the net module's error codes. | 15 // Error domain of the net module's error codes. |
14 extern const char kErrorDomain[]; | 16 extern const char kErrorDomain[]; |
15 | 17 |
16 // Error values are negative. | 18 // Error values are negative. |
17 enum Error { | 19 enum Error { |
18 // No error. | 20 // No error. |
(...skipping 13 matching lines...) Expand all Loading... |
32 // Returns true if |error| is a certificate error code. | 34 // Returns true if |error| is a certificate error code. |
33 inline bool IsCertificateError(int error) { | 35 inline bool IsCertificateError(int error) { |
34 // Certificate errors are negative integers from net::ERR_CERT_BEGIN | 36 // Certificate errors are negative integers from net::ERR_CERT_BEGIN |
35 // (inclusive) to net::ERR_CERT_END (exclusive) in *decreasing* order. | 37 // (inclusive) to net::ERR_CERT_END (exclusive) in *decreasing* order. |
36 return error <= ERR_CERT_BEGIN && error > ERR_CERT_END; | 38 return error <= ERR_CERT_BEGIN && error > ERR_CERT_END; |
37 } | 39 } |
38 | 40 |
39 // Map system error code to Error. | 41 // Map system error code to Error. |
40 Error MapSystemError(int os_error); | 42 Error MapSystemError(int os_error); |
41 | 43 |
| 44 // Returns a list of all the possible net error codes (not counting OK). This |
| 45 // is intended for use with UMA histograms that are reporting the result of |
| 46 // an action that is represented as a net error code. |
| 47 // |
| 48 // Note that the error codes are all positive (since histograms expect positive |
| 49 // sample values). |
| 50 std::vector<int> GetAllErrorCodesForUma(); |
| 51 |
42 } // namespace net | 52 } // namespace net |
43 | 53 |
44 #endif // NET_BASE_NET_ERRORS_H__ | 54 #endif // NET_BASE_NET_ERRORS_H__ |
OLD | NEW |