Removing ContentViewCore dependencies from few functions which acts as direct wrapper...
[chromium-blink-merge.git] / net / base / net_errors.h
blob4dc6042b65eb9abb8c1bf64268e29d30fb2d420f
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
3 // found in the LICENSE file.
5 #ifndef NET_BASE_NET_ERRORS_H__
6 #define NET_BASE_NET_ERRORS_H__
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/files/file.h"
13 #include "net/base/net_export.h"
15 namespace net {
17 // Error domain of the net module's error codes.
18 NET_EXPORT extern const char kErrorDomain[];
20 // Error values are negative.
21 enum Error {
22 // No error.
23 OK = 0,
25 #define NET_ERROR(label, value) ERR_ ## label = value,
26 #include "net/base/net_error_list.h"
27 #undef NET_ERROR
29 // The value of the first certificate error code.
30 ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID,
33 // Returns a textual representation of the error code for logging purposes.
34 NET_EXPORT std::string ErrorToString(int error);
36 // Same as above, but leaves off the leading "net::".
37 NET_EXPORT std::string ErrorToShortString(int error);
39 // Returns true if |error| is a certificate error code.
40 NET_EXPORT bool IsCertificateError(int error);
42 // Map system error code to Error.
43 NET_EXPORT Error MapSystemError(int os_error);
45 // Returns a list of all the possible net error codes (not counting OK). This
46 // is intended for use with UMA histograms that are reporting the result of
47 // an action that is represented as a net error code.
49 // Note that the error codes are all positive (since histograms expect positive
50 // sample values). Also note that a guard bucket is created after any valid
51 // error code that is not followed immediately by a valid error code.
52 NET_EXPORT std::vector<int> GetAllErrorCodesForUma();
54 // A convenient function to translate file error to net error code.
55 NET_EXPORT Error FileErrorToNetError(base::File::Error file_error);
57 } // namespace net
59 #endif // NET_BASE_NET_ERRORS_H__