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 #include "net/base/net_errors.h" | 5 #include "net/base/net_errors.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/stringize_macros.h" | 9 #include "base/stringize_macros.h" |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 default: | 37 default: |
38 return "net::<unknown>"; | 38 return "net::<unknown>"; |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 std::vector<int> GetAllErrorCodesForUma() { | 42 std::vector<int> GetAllErrorCodesForUma() { |
43 return base::CustomHistogram::ArrayToCustomRanges( | 43 return base::CustomHistogram::ArrayToCustomRanges( |
44 kAllErrorCodes, arraysize(kAllErrorCodes)); | 44 kAllErrorCodes, arraysize(kAllErrorCodes)); |
45 } | 45 } |
46 | 46 |
| 47 int PlatformFileErrorToNetError( |
| 48 base::PlatformFileError file_error) { |
| 49 switch (file_error) { |
| 50 case base::PLATFORM_FILE_OK: |
| 51 return net::OK; |
| 52 case base::PLATFORM_FILE_ERROR_NOT_FOUND: |
| 53 return net::ERR_FILE_NOT_FOUND; |
| 54 case base::PLATFORM_FILE_ERROR_ACCESS_DENIED: |
| 55 return net::ERR_ACCESS_DENIED; |
| 56 default: |
| 57 return net::ERR_FAILED; |
| 58 } |
| 59 } |
| 60 |
47 } // namespace net | 61 } // namespace net |
OLD | NEW |