Chromium Code Reviews| 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 // This file's dependencies should be kept to a minimum so that it can be | 5 // This file's dependencies should be kept to a minimum so that it can be |
| 6 // included in WebKit code that doesn't rely on much of common. | 6 // included in WebKit code that doesn't rely on much of common. |
| 7 | 7 |
| 8 #ifndef NET_URL_REQUEST_URL_REQUEST_STATUS_H_ | 8 #ifndef NET_URL_REQUEST_URL_REQUEST_STATUS_H_ |
| 9 #define NET_URL_REQUEST_URL_REQUEST_STATUS_H_ | 9 #define NET_URL_REQUEST_URL_REQUEST_STATUS_H_ |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 // Represents the result of a URL request. It encodes errors and various | 13 // Represents the result of a URL request. It encodes errors and various |
| 14 // types of success. | 14 // types of success. |
| 15 class URLRequestStatus { | 15 class URLRequestStatus { |
| 16 public: | 16 public: |
| 17 enum Status { | 17 enum Status { |
| 18 // Request succeeded, |error_| will be 0. | 18 // Request succeeded, |error_| will be 0. |
| 19 SUCCESS = 0, | 19 SUCCESS = 0, |
| 20 | 20 |
| 21 // An IO request is pending, and the caller will be informed when it is | 21 // An IO request is pending, and the caller will be informed when it is |
| 22 // completed. | 22 // completed. |
| 23 IO_PENDING, | 23 IO_PENDING, |
| 24 | 24 |
| 25 // Request was cancelled programatically. | 25 // Request was cancelled programatically. |
| 26 CANCELED, | 26 CANCELED, |
| 27 | 27 |
| 28 // The request failed for some reason. |error_| may have more information. | 28 // The request failed for some reason. |error_| may have more information. |
| 29 FAILED, | 29 FAILED, |
| 30 | |
| 31 // So that Status enums can be used in histograms, always add new values | |
| 32 // before this one, and do not change existing values. | |
| 33 STATUS_MAX | |
|
mattm
2013/07/24 02:19:00
any objections to this?
mmenke
2013/07/24 14:26:50
Nope, I'm fine with it... But I'm not sure we nee
| |
| 30 }; | 34 }; |
| 31 | 35 |
| 32 URLRequestStatus() : status_(SUCCESS), error_(0) {} | 36 URLRequestStatus() : status_(SUCCESS), error_(0) {} |
| 33 URLRequestStatus(Status s, int e) : status_(s), error_(e) {} | 37 URLRequestStatus(Status s, int e) : status_(s), error_(e) {} |
| 34 | 38 |
| 35 Status status() const { return status_; } | 39 Status status() const { return status_; } |
| 36 void set_status(Status s) { status_ = s; } | 40 void set_status(Status s) { status_ = s; } |
| 37 | 41 |
| 38 int error() const { return error_; } | 42 int error() const { return error_; } |
| 39 void set_error(int e) { error_ = e; } | 43 void set_error(int e) { error_ = e; } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 53 // Application level status. | 57 // Application level status. |
| 54 Status status_; | 58 Status status_; |
| 55 | 59 |
| 56 // Error code from the network layer if an error was encountered. | 60 // Error code from the network layer if an error was encountered. |
| 57 int error_; | 61 int error_; |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 } // namespace net | 64 } // namespace net |
| 61 | 65 |
| 62 #endif // NET_URL_REQUEST_URL_REQUEST_STATUS_H_ | 66 #endif // NET_URL_REQUEST_URL_REQUEST_STATUS_H_ |
| OLD | NEW |