Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: net/url_request/url_request_status.h

Issue 1459333002: Revert "Reland: URLRequestJob: change ReadRawData contract" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_simple_job.cc ('k') | net/url_request/url_request_status.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_URL_REQUEST_URL_REQUEST_STATUS_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_STATUS_H_
6 #define NET_URL_REQUEST_URL_REQUEST_STATUS_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_STATUS_H_
7 7
8 #include "net/base/net_errors.h"
9 #include "net/base/net_export.h" 8 #include "net/base/net_export.h"
10 9
11 namespace net { 10 namespace net {
12 11
13 // Represents the result of a URL request. It encodes errors and various 12 // Represents the result of a URL request. It encodes errors and various
14 // types of success. 13 // types of success.
15 class NET_EXPORT URLRequestStatus { 14 class NET_EXPORT URLRequestStatus {
16 public: 15 public:
17 enum Status { 16 enum Status {
18 // Request succeeded, |error_| will be 0. 17 // Request succeeded, |error_| will be 0.
(...skipping 16 matching lines...) Expand all
35 // Creates a URLRequestStatus with specified status and error parameters. New 34 // Creates a URLRequestStatus with specified status and error parameters. New
36 // consumers should use URLRequestStatus::FromError instead. 35 // consumers should use URLRequestStatus::FromError instead.
37 URLRequestStatus(Status status, int error); 36 URLRequestStatus(Status status, int error);
38 37
39 // Creates a URLRequestStatus, initializing the status from |error|. OK maps 38 // Creates a URLRequestStatus, initializing the status from |error|. OK maps
40 // to SUCCESS, ERR_IO_PENDING maps to IO_PENDING, ERR_ABORTED maps to CANCELED 39 // to SUCCESS, ERR_IO_PENDING maps to IO_PENDING, ERR_ABORTED maps to CANCELED
41 // and all others map to FAILED. Other combinations of status and error are 40 // and all others map to FAILED. Other combinations of status and error are
42 // deprecated. See https://crbug.com/490311. 41 // deprecated. See https://crbug.com/490311.
43 static URLRequestStatus FromError(int error); 42 static URLRequestStatus FromError(int error);
44 43
45 // Returns a Error corresponding to |status_|.
46 // OK for OK
47 // ERR_IO_PENDING for IO_PENDING
48 // ERR_ABORTED for CANCELLED
49 // Error for FAILED
50 Error ToNetError() const;
51
52 Status status() const { return status_; } 44 Status status() const { return status_; }
53 int error() const { return error_; } 45 int error() const { return error_; }
54 46
55 // Returns true if the status is success, which makes some calling code more 47 // Returns true if the status is success, which makes some calling code more
56 // convenient because this is the most common test. 48 // convenient because this is the most common test.
57 bool is_success() const { 49 bool is_success() const {
58 return status_ == SUCCESS || status_ == IO_PENDING; 50 return status_ == SUCCESS || status_ == IO_PENDING;
59 } 51 }
60 52
61 // Returns true if the request is waiting for IO. 53 // Returns true if the request is waiting for IO.
62 bool is_io_pending() const { 54 bool is_io_pending() const {
63 return status_ == IO_PENDING; 55 return status_ == IO_PENDING;
64 } 56 }
65 57
66 private: 58 private:
67 // Application level status. 59 // Application level status.
68 Status status_; 60 Status status_;
69 61
70 // Error code from the network layer if an error was encountered. 62 // Error code from the network layer if an error was encountered.
71 int error_; 63 int error_;
72 }; 64 };
73 65
74 } // namespace net 66 } // namespace net
75 67
76 #endif // NET_URL_REQUEST_URL_REQUEST_STATUS_H_ 68 #endif // NET_URL_REQUEST_URL_REQUEST_STATUS_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_simple_job.cc ('k') | net/url_request/url_request_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698