diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 21:09:05 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 21:09:05 +0000 |
commit | 3c1c09661eed67a336f309c247fae2c478e4c9e0 (patch) | |
tree | fb281501ceac2b577df93262ad1dbb92b892e354 /net/base/network_delegate.h | |
parent | 41daf23757b53313f7be037204949752400c02f1 (diff) | |
download | chromium_src-3c1c09661eed67a336f309c247fae2c478e4c9e0.zip chromium_src-3c1c09661eed67a336f309c247fae2c478e4c9e0.tar.gz chromium_src-3c1c09661eed67a336f309c247fae2c478e4c9e0.tar.bz2 |
Allow extensions to redirect requests in onBeforeRequest.
BUG=60101
TEST=no
Review URL: http://codereview.chromium.org/6677148
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81479 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/network_delegate.h')
-rw-r--r-- | net/base/network_delegate.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h index effc699..eafb212 100644 --- a/net/base/network_delegate.h +++ b/net/base/network_delegate.h @@ -9,6 +9,8 @@ #include "base/threading/non_thread_safe.h" #include "net/base/completion_callback.h" +class GURL; + namespace net { // NOTE: Layering violations! @@ -34,10 +36,11 @@ class NetworkDelegate : public base::NonThreadSafe { // checking on parameters. See the corresponding virtuals for explanations of // the methods and their arguments. int NotifyBeforeURLRequest(URLRequest* request, - CompletionCallback* callback); + CompletionCallback* callback, + GURL* new_url); int NotifyBeforeSendHeaders(uint64 request_id, - HttpRequestHeaders* headers, - CompletionCallback* callback); + CompletionCallback* callback, + HttpRequestHeaders* headers); void NotifyResponseStarted(URLRequest* request); void NotifyReadCompleted(URLRequest* request, int bytes_read); void NotifyURLRequestDestroyed(URLRequest* request); @@ -55,20 +58,22 @@ 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. The callback can be called at any time, - // but will have no effect if the request has already been cancelled or + // Called before a request is sent. Allows the delegate to rewrite the URL + // being fetched by modifying |new_url|. 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; + CompletionCallback* callback, + GURL* new_url) = 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; + CompletionCallback* callback, + HttpRequestHeaders* headers) = 0; // This corresponds to URLRequestDelegate::OnResponseStarted. virtual void OnResponseStarted(URLRequest* request) = 0; |