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

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

Issue 10640019: Remove the HANDLED_EXTERNALLY status code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed some minor issues Created 8 years, 5 months 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
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 // 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 #pragma once 10 #pragma once
11 11
12 namespace net { 12 namespace net {
13 13
14 // Represents the result of a URL request. It encodes errors and various 14 // Represents the result of a URL request. It encodes errors and various
15 // types of success. 15 // types of success.
16 class URLRequestStatus { 16 class URLRequestStatus {
17 public: 17 public:
18 enum Status { 18 enum Status {
19 // Request succeeded, |error_| will be 0. 19 // Request succeeded, |error_| will be 0.
20 SUCCESS = 0, 20 SUCCESS = 0,
21 21
22 // An IO request is pending, and the caller will be informed when it is 22 // An IO request is pending, and the caller will be informed when it is
23 // completed. 23 // completed.
24 IO_PENDING, 24 IO_PENDING,
25 25
26 // Request was successful but was handled by an external program, so there
27 // is no response data. This usually means the current page should not be
28 // navigated, but no error should be displayed. |error_| will be 0.
29 HANDLED_EXTERNALLY,
30
31 // Request was cancelled programatically. 26 // Request was cancelled programatically.
32 CANCELED, 27 CANCELED,
33 28
34 // The request failed for some reason. |error_| may have more information. 29 // The request failed for some reason. |error_| may have more information.
35 FAILED, 30 FAILED,
36 }; 31 };
37 32
38 URLRequestStatus() : status_(SUCCESS), error_(0) {} 33 URLRequestStatus() : status_(SUCCESS), error_(0) {}
39 URLRequestStatus(Status s, int e) : status_(s), error_(e) {} 34 URLRequestStatus(Status s, int e) : status_(s), error_(e) {}
40 35
41 Status status() const { return status_; } 36 Status status() const { return status_; }
42 void set_status(Status s) { status_ = s; } 37 void set_status(Status s) { status_ = s; }
43 38
44 int error() const { return error_; } 39 int error() const { return error_; }
45 void set_error(int e) { error_ = e; } 40 void set_error(int e) { error_ = e; }
46 41
47 // Returns true if the status is success, which makes some calling code more 42 // Returns true if the status is success, which makes some calling code more
48 // convenient because this is the most common test. Note that we do NOT treat 43 // convenient because this is the most common test.
49 // HANDLED_EXTERNALLY as success. For everything except user notifications,
50 // this value should be handled like an error (processing should stop).
51 bool is_success() const { 44 bool is_success() const {
52 return status_ == SUCCESS || status_ == IO_PENDING; 45 return status_ == SUCCESS || status_ == IO_PENDING;
53 } 46 }
54 47
55 // Returns true if the request is waiting for IO. 48 // Returns true if the request is waiting for IO.
56 bool is_io_pending() const { 49 bool is_io_pending() const {
57 return status_ == IO_PENDING; 50 return status_ == IO_PENDING;
58 } 51 }
59 52
60 private: 53 private:
61 // Application level status. 54 // Application level status.
62 Status status_; 55 Status status_;
63 56
64 // Error code from the network layer if an error was encountered. 57 // Error code from the network layer if an error was encountered.
65 int error_; 58 int error_;
66 }; 59 };
67 60
68 } // namespace net 61 } // namespace net
69 62
70 #endif // NET_URL_REQUEST_URL_REQUEST_STATUS_H_ 63 #endif // NET_URL_REQUEST_URL_REQUEST_STATUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698