Chromium Code Reviews| Index: net/base/network_delegate.h |
| diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h |
| index 284728b40d6c5ab6352643c221e48945d6b11455..2d3f55d53f04710b5f92a996b9d31d1a51ea3378 100644 |
| --- a/net/base/network_delegate.h |
| +++ b/net/base/network_delegate.h |
| @@ -31,12 +31,16 @@ class NetworkDelegate : public base::NonThreadSafe { |
| // Notification interface called by the network stack. Note that these |
| // functions mostly forward to the private virtuals. They also add some sanity |
| - // checking on parameters. |
| - bool NotifyBeforeURLRequest(URLRequest* request, |
| + // checking on parameters. See the corresponding virtuals for explanations of |
| + // the methods and their arguments. |
| + int NotifyBeforeURLRequest(URLRequest* request, |
| + CompletionCallback* callback); |
| + int NotifyBeforeSendHeaders(uint64 request_id, |
| + HttpRequestHeaders* headers, |
| CompletionCallback* callback); |
| - void NotifySendHttpRequest(HttpRequestHeaders* headers); |
| void NotifyResponseStarted(URLRequest* request); |
| void NotifyReadCompleted(URLRequest* request, int bytes_read); |
| + void NotifyURLRequestDestroyed(URLRequest* request); |
| // Returns a URLRequestJob that will be used to handle the request if |
| // non-null. |
| @@ -51,13 +55,20 @@ class NetworkDelegate : public base::NonThreadSafe { |
| // member functions will be called by the respective public notification |
| // member function, which will perform basic sanity checking. |
| - // Called before a request is sent. |
| - virtual bool OnBeforeURLRequest(URLRequest* request, |
| - CompletionCallback* callback) = 0; |
| + // Called before a request is sent. The callback can be called at any time, |
| + // but will have no effect if the request has already been cancelled or |
| + // deleted. Returns a net status code, generally either OK to continue with |
| + // the request or ERR_IO_PENDING if the result is not ready yet. |
| + virtual int OnBeforeURLRequest(URLRequest* request, |
| + CompletionCallback* callback) = 0; |
| - // Called right before the HTTP headers are sent. Allows the delegate to |
| - // read/write |headers| before they get sent out. |
| - virtual void OnSendHttpRequest(HttpRequestHeaders* headers) = 0; |
| + // Called right before the HTTP headers are sent. Allows the delegate to |
| + // read/write |headers| before they get sent out. The callback can be called |
| + // at any time, but will have no effect if the transaction handling this |
| + // request has been cancelled. Returns a net status code. |
| + virtual int OnBeforeSendHeaders(uint64 request_id, |
| + HttpRequestHeaders* headers, |
| + CompletionCallback* callback) = 0; |
| // This corresponds to URLRequestDelegate::OnResponseStarted. |
| virtual void OnResponseStarted(URLRequest* request) = 0; |
| @@ -65,9 +76,13 @@ class NetworkDelegate : public base::NonThreadSafe { |
| // This corresponds to URLRequestDelegate::OnReadCompleted. |
| virtual void OnReadCompleted(URLRequest* request, int bytes_read) = 0; |
| + // Called when an URLRequest is being destroyed. |
|
willchan no longer on Chromium
2011/03/26 01:46:49
Please note that we're already in the destructor,
Matt Perry
2011/03/28 22:51:01
Added a comment. (calling accessors is fine, just
|
| + virtual void OnURLRequestDestroyed(URLRequest* request) = 0; |
| + |
| // Called before a request is sent and before a URLRequestJob is created to |
| // handle the request. |
| virtual URLRequestJob* OnMaybeCreateURLRequestJob(URLRequest* request) = 0; |
| + |
| }; |
| } // namespace net |