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

Unified Diff: net/base/network_delegate.h

Issue 6698009: Add request_id to HttpRequestInfo and pass it to the NetworkDelegate for events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 500 error Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest/events/test.html ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_delegate.h
diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h
index 284728b40d6c5ab6352643c221e48945d6b11455..effc699ef5c8f8202a756c495b5ed035e535c9b1 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,15 @@ 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. Note that the request is
+ // being deleted, so it's not safe to call any methods that may result in
+ // a virtual method call.
+ 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
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest/events/test.html ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698