diff options
author | Iain Merrick <husky@google.com> | 2010-11-01 12:19:54 +0000 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-11-03 10:21:10 +0000 |
commit | 731df977c0511bca2206b5f333555b1205ff1f43 (patch) | |
tree | 0e750b949b3f00a1ac11fda25d3c2de512f2b465 /webkit/glue/weburlloader_impl.cc | |
parent | 5add15e10e7bb80512f2c597ca57221314abe577 (diff) | |
download | external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2 |
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'webkit/glue/weburlloader_impl.cc')
-rw-r--r-- | webkit/glue/weburlloader_impl.cc | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc index aa63fc2..374f132 100644 --- a/webkit/glue/weburlloader_impl.cc +++ b/webkit/glue/weburlloader_impl.cc @@ -18,6 +18,7 @@ #include "net/base/net_util.h" #include "net/http/http_response_headers.h" #include "third_party/WebKit/WebKit/chromium/public/WebHTTPHeaderVisitor.h" +#include "third_party/WebKit/WebKit/chromium/public/WebResourceRawHeaders.h" #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" @@ -36,6 +37,7 @@ using base::TimeDelta; using WebKit::WebData; using WebKit::WebHTTPBody; using WebKit::WebHTTPHeaderVisitor; +using WebKit::WebResourceRawHeaders; using WebKit::WebSecurityPolicy; using WebKit::WebString; using WebKit::WebURL; @@ -142,7 +144,7 @@ ResourceType::Type FromTargetType(WebURLRequest::TargetType type) { // Extracts the information from a data: url. bool GetInfoFromDataURL(const GURL& url, - ResourceLoaderBridge::ResponseInfo* info, + ResourceResponseInfo* info, std::string* data, URLRequestStatus* status) { std::string mime_type; std::string charset; @@ -163,9 +165,11 @@ bool GetInfoFromDataURL(const GURL& url, return false; } +typedef ResourceDevToolsInfo::HeadersVector HeadersVector; + void PopulateURLResponse( const GURL& url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, WebURLResponse* response) { response->setURL(url); response->setResponseTime(info.response_time.ToDoubleT()); @@ -188,7 +192,7 @@ void PopulateURLResponse( WebURLLoadTiming timing; timing.initialize(); - const ResourceLoaderBridge::LoadTimingInfo& timing_info = info.load_timing; + const ResourceLoadTimingInfo& timing_info = info.load_timing; timing.setRequestTime(timing_info.base_time.ToDoubleT()); timing.setProxyStart(timing_info.proxy_start); timing.setProxyEnd(timing_info.proxy_end); @@ -203,6 +207,25 @@ void PopulateURLResponse( timing.setReceiveHeadersEnd(timing_info.receive_headers_end); response->setLoadTiming(timing); + if (info.devtools_info.get()) { + WebResourceRawHeaders rawHeaders; + + const HeadersVector& request_headers = info.devtools_info->request_headers; + for (HeadersVector::const_iterator it = request_headers .begin(); + it != request_headers.end(); ++it) { + rawHeaders.addRequestHeader(WebString::fromUTF8(it->first), + WebString::fromUTF8(it->second)); + } + const HeadersVector& response_headers = + info.devtools_info->response_headers; + for (HeadersVector::const_iterator it = response_headers.begin(); + it != response_headers.end(); ++it) { + rawHeaders.addResponseHeader(WebString::fromUTF8(it->first), + WebString::fromUTF8(it->second)); + } + response->setResourceRawHeaders(rawHeaders); + } + const net::HttpResponseHeaders* headers = info.headers; if (!headers) return; @@ -258,11 +281,11 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, virtual void OnUploadProgress(uint64 position, uint64 size); virtual bool OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies); virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); + const ResourceResponseInfo& info, bool content_filtered); virtual void OnDownloadedData(int len); virtual void OnReceivedData(const char* data, int len); virtual void OnReceivedCachedMetadata(const char* data, int len); @@ -364,6 +387,8 @@ void WebURLLoaderImpl::Context::Start( load_flags |= net::LOAD_ENABLE_UPLOAD_PROGRESS; if (request.reportLoadTiming()) load_flags |= net::LOAD_ENABLE_LOAD_TIMING; + if (request.reportRawHeaders()) + load_flags |= net::LOAD_REPORT_RAW_HEADERS; if (!request.allowCookies() || !request.allowStoredCredentials()) { load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES; @@ -373,7 +398,6 @@ void WebURLLoaderImpl::Context::Start( if (!request.allowStoredCredentials()) load_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA; - // TODO(jcampan): in the non out-of-process plugin case the request does not // have a requestor_pid. Find a better place to set this. int requestor_pid = request.requestorProcessID(); @@ -464,7 +488,7 @@ void WebURLLoaderImpl::Context::OnUploadProgress(uint64 position, uint64 size) { bool WebURLLoaderImpl::Context::OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { if (!client_) @@ -478,6 +502,7 @@ bool WebURLLoaderImpl::Context::OnReceivedRedirect( // request that resulted from the redirect. WebURLRequest new_request(new_url); new_request.setFirstPartyForCookies(request_.firstPartyForCookies()); + new_request.setDownloadToFile(request_.downloadToFile()); WebString referrer_string = WebString::fromUTF8("Referer"); WebString referrer = request_.httpHeaderField(referrer_string); @@ -503,7 +528,7 @@ bool WebURLLoaderImpl::Context::OnReceivedRedirect( } void WebURLLoaderImpl::Context::OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { if (!client_) return; @@ -638,7 +663,7 @@ GURL WebURLLoaderImpl::Context::GetURLForDebugging() const { } void WebURLLoaderImpl::Context::HandleDataURL() { - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; URLRequestStatus status; std::string data; |