diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-03 18:23:57 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-03 18:23:57 +0000 |
commit | bb445ce3e4cf005b673c1a062575ee18dbddfdc9 (patch) | |
tree | 6c7f5d96968d0dd027fe5786342d667787aeaf18 /net | |
parent | 627d9344c2733f6160927dac527e67a6c79d9304 (diff) | |
download | chromium_src-bb445ce3e4cf005b673c1a062575ee18dbddfdc9.zip chromium_src-bb445ce3e4cf005b673c1a062575ee18dbddfdc9.tar.gz chromium_src-bb445ce3e4cf005b673c1a062575ee18dbddfdc9.tar.bz2 |
Tweaks to extension webRequest API.
- onBeforeSendHeaders respects extraInfoSpec.
- request headers are now an array of {name, value} objects instead of a flat
string.
- onBeforeRequest is sent after redirects now. This allows extensions to intercept
redirects and cancel/redirect them elsewhere.
BUG=60101
TEST=no
Review URL: http://codereview.chromium.org/6912008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/url_request/url_request.cc | 10 | ||||
-rw-r--r-- | net/url_request/url_request.h | 2 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.cc | 5 |
3 files changed, 8 insertions, 9 deletions
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 0f19d69..d1d46bfb 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -371,7 +371,7 @@ void URLRequest::Start() { } } - StartInternal(); + StartJob(URLRequestJobManager::GetInstance()->CreateJob(this)); } /////////////////////////////////////////////////////////////////////////////// @@ -388,14 +388,10 @@ void URLRequest::BeforeRequestComplete(int error) { new_url.Swap(&delegate_redirect_url_); StartJob(new URLRequestRedirectJob(this, new_url)); } else { - StartInternal(); + StartJob(URLRequestJobManager::GetInstance()->CreateJob(this)); } } -void URLRequest::StartInternal() { - StartJob(URLRequestJobManager::GetInstance()->CreateJob(this)); -} - void URLRequest::StartJob(URLRequestJob* job) { DCHECK(!is_pending_); DCHECK(!job_); @@ -638,7 +634,7 @@ int URLRequest::Redirect(const GURL& location, int http_status_code) { final_upload_progress_ = job_->GetUploadProgress(); PrepareToRestart(); - StartInternal(); + Start(); return OK; } diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index b6d58ce..2ad1162 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -587,8 +587,6 @@ class URLRequest : public base::NonThreadSafe { friend class URLRequestJob; typedef std::map<const void*, linked_ptr<UserData> > UserDataMap; - void StartInternal(); - // Resumes or blocks a request paused by the NetworkDelegate::OnBeforeRequest // handler. If |blocked| is true, the request is blocked and an error page is // returned indicating so. This should only be called after Start is called diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index f32af25..1c0987f 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -137,6 +137,11 @@ class BlockingNetworkDelegate : public TestNetworkDelegate { virtual int OnBeforeURLRequest(net::URLRequest* request, net::CompletionCallback* callback, GURL* new_url) { + if (redirect_url_ == request->url()) { + // We've already seen this request and redirected elsewhere. + return net::OK; + } + TestNetworkDelegate::OnBeforeURLRequest(request, callback, new_url); if (!redirect_url_.is_empty()) |