| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file replaces WebCore/platform/network/win/ResourceHandleWin.cpp with a | 5 // This file replaces WebCore/platform/network/win/ResourceHandleWin.cpp with a |
| 6 // platform-neutral implementation that simply defers almost entirely to | 6 // platform-neutral implementation that simply defers almost entirely to |
| 7 // ResouceLoaderBridge. | 7 // ResouceLoaderBridge. |
| 8 // | 8 // |
| 9 // This uses the same ResourceHandle.h header file that the rest of WebKit | 9 // This uses the same ResourceHandle.h header file that the rest of WebKit |
| 10 // uses, allowing us to avoid complicated changes. Our specific things are | 10 // uses, allowing us to avoid complicated changes. Our specific things are |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } else { | 185 } else { |
| 186 // WebKit uses 0 as a special expiration date that means never expire. | 186 // WebKit uses 0 as a special expiration date that means never expire. |
| 187 // 1 is a small enough value to let it always expire. | 187 // 1 is a small enough value to let it always expire. |
| 188 response.setExpirationDate(1); | 188 response.setExpirationDate(1); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 response.setHTTPStatusCode(status_code); | 192 response.setHTTPStatusCode(status_code); |
| 193 response.setHTTPStatusText(status_text); | 193 response.setHTTPStatusText(status_text); |
| 194 response.setSecurityInfo(webkit_glue::StdStringToCString(info.security_info)); | 194 response.setSecurityInfo(webkit_glue::StdStringToCString(info.security_info)); |
| 195 response.setAppCacheID(info.app_cache_id); |
| 195 | 196 |
| 196 // WebKit doesn't provide a way for us to set expected content length after | 197 // WebKit doesn't provide a way for us to set expected content length after |
| 197 // calling the constructor, so we parse the headers first and then swap in | 198 // calling the constructor, so we parse the headers first and then swap in |
| 198 // our HTTP header map. Ideally we would like a setter for expected content | 199 // our HTTP header map. Ideally we would like a setter for expected content |
| 199 // length (perhaps by abstracting ResourceResponse interface into | 200 // length (perhaps by abstracting ResourceResponse interface into |
| 200 // ResourceResponseBase) but that would require forking. | 201 // ResourceResponseBase) but that would require forking. |
| 201 const_cast<HTTPHeaderMap*>(&response.httpHeaderFields())->swap(header_map); | 202 const_cast<HTTPHeaderMap*>(&response.httpHeaderFields())->swap(header_map); |
| 202 | 203 |
| 203 return response; | 204 return response; |
| 204 } | 205 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 referrer, | 425 referrer, |
| 425 frame_origin, | 426 frame_origin, |
| 426 main_frame_origin, | 427 main_frame_origin, |
| 427 webkit_glue::CStringToStdString(headerBuf.latin1()), | 428 webkit_glue::CStringToStdString(headerBuf.latin1()), |
| 428 // TODO(abarth): webkit_glue::StringToStdString( | 429 // TODO(abarth): webkit_glue::StringToStdString( |
| 429 // request_.defaultMimeType()); | 430 // request_.defaultMimeType()); |
| 430 "", | 431 "", |
| 431 load_flags_, | 432 load_flags_, |
| 432 requestor_pid, | 433 requestor_pid, |
| 433 FromTargetType(request_.targetType()), | 434 FromTargetType(request_.targetType()), |
| 435 request_.appCacheContextID(), |
| 434 request_.requestorID())); | 436 request_.requestorID())); |
| 435 if (!bridge_.get()) | 437 if (!bridge_.get()) |
| 436 return false; | 438 return false; |
| 437 | 439 |
| 438 if (request_.httpBody()) { | 440 if (request_.httpBody()) { |
| 439 // GET and HEAD requests shouldn't have http bodies. | 441 // GET and HEAD requests shouldn't have http bodies. |
| 440 DCHECK(method != "GET" && method != "HEAD"); | 442 DCHECK(method != "GET" && method != "HEAD"); |
| 441 const Vector<FormDataElement>& elements = request_.httpBody()->elements(); | 443 const Vector<FormDataElement>& elements = request_.httpBody()->elements(); |
| 442 size_t n = elements.size(); | 444 size_t n = elements.size(); |
| 443 for (size_t i = 0; i < n; ++i) { | 445 for (size_t i = 0; i < n; ++i) { |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 // if the request cannot be serviced from cache. We force the 'DontLoad' | 757 // if the request cannot be serviced from cache. We force the 'DontLoad' |
| 756 // cache policy at this point to ensure that we never hit the network for | 758 // cache policy at this point to ensure that we never hit the network for |
| 757 // this request. | 759 // this request. |
| 758 // | 760 // |
| 759 DCHECK(request.httpMethod() == "POST"); | 761 DCHECK(request.httpMethod() == "POST"); |
| 760 request.setCachePolicy(ReturnCacheDataDontLoad); | 762 request.setCachePolicy(ReturnCacheDataDontLoad); |
| 761 return true; | 763 return true; |
| 762 } | 764 } |
| 763 | 765 |
| 764 } // namespace WebCore | 766 } // namespace WebCore |
| OLD | NEW |