OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/url_request/url_request_status.h" | 5 #include "net/url_request/url_request_status.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 28 matching lines...) Expand all Loading... |
39 return URLRequestStatus(SUCCESS, OK); | 39 return URLRequestStatus(SUCCESS, OK); |
40 } else if (error == ERR_IO_PENDING) { | 40 } else if (error == ERR_IO_PENDING) { |
41 return URLRequestStatus(IO_PENDING, ERR_IO_PENDING); | 41 return URLRequestStatus(IO_PENDING, ERR_IO_PENDING); |
42 } else if (error == ERR_ABORTED) { | 42 } else if (error == ERR_ABORTED) { |
43 return URLRequestStatus(CANCELED, ERR_ABORTED); | 43 return URLRequestStatus(CANCELED, ERR_ABORTED); |
44 } else { | 44 } else { |
45 return URLRequestStatus(FAILED, error); | 45 return URLRequestStatus(FAILED, error); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 Error URLRequestStatus::ToNetError() const { | |
50 switch (status_) { | |
51 case SUCCESS: | |
52 return OK; | |
53 case IO_PENDING: | |
54 return ERR_IO_PENDING; | |
55 case CANCELED: | |
56 return ERR_ABORTED; | |
57 case FAILED: | |
58 return static_cast<Error>(error_); | |
59 } | |
60 NOTREACHED(); | |
61 return ERR_FAILED; | |
62 } | |
63 | |
64 } // namespace net | 49 } // namespace net |
OLD | NEW |