| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 headerBuf.append(crlf); | 409 headerBuf.append(crlf); |
| 410 headerBuf.append((*it).first + sep + (*it).second); | 410 headerBuf.append((*it).first + sep + (*it).second); |
| 411 } | 411 } |
| 412 | 412 |
| 413 // TODO(jcampan): in the non out-of-process plugin case the request does not | 413 // TODO(jcampan): in the non out-of-process plugin case the request does not |
| 414 // have a origin_pid. Find a better place to set this. | 414 // have a origin_pid. Find a better place to set this. |
| 415 int origin_pid = request_.originPid(); | 415 int origin_pid = request_.originPid(); |
| 416 if (origin_pid == 0) | 416 if (origin_pid == 0) |
| 417 origin_pid = base::GetCurrentProcId(); | 417 origin_pid = base::GetCurrentProcId(); |
| 418 | 418 |
| 419 bool mixed_content = | |
| 420 webkit_glue::KURLToGURL(request_.mainDocumentURL()).SchemeIsSecure() && | |
| 421 !url.SchemeIsSecure(); | |
| 422 | |
| 423 if (url.SchemeIs("data")) { | 419 if (url.SchemeIs("data")) { |
| 424 if (sync_load_response) { | 420 if (sync_load_response) { |
| 425 // This is a sync load. Do the work now. | 421 // This is a sync load. Do the work now. |
| 426 sync_load_response->url = url; | 422 sync_load_response->url = url; |
| 427 std::string data; | 423 std::string data; |
| 428 GetInfoFromDataUrl(sync_load_response->url, sync_load_response, | 424 GetInfoFromDataUrl(sync_load_response->url, sync_load_response, |
| 429 &sync_load_response->data, | 425 &sync_load_response->data, |
| 430 &sync_load_response->status); | 426 &sync_load_response->status); |
| 431 } else { | 427 } else { |
| 432 pending_ = true; | 428 pending_ = true; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 445 // creating the GURLs. | 441 // creating the GURLs. |
| 446 bridge_.reset(ResourceLoaderBridge::Create( | 442 bridge_.reset(ResourceLoaderBridge::Create( |
| 447 webframe, | 443 webframe, |
| 448 webkit_glue::CStringToStdString(method), | 444 webkit_glue::CStringToStdString(method), |
| 449 url, | 445 url, |
| 450 policy_url, | 446 policy_url, |
| 451 referrer, | 447 referrer, |
| 452 webkit_glue::CStringToStdString(headerBuf.latin1()), | 448 webkit_glue::CStringToStdString(headerBuf.latin1()), |
| 453 load_flags_, | 449 load_flags_, |
| 454 origin_pid, | 450 origin_pid, |
| 455 FromTargetType(request_.targetType()), | 451 FromTargetType(request_.targetType()))); |
| 456 mixed_content)); | |
| 457 if (!bridge_.get()) | 452 if (!bridge_.get()) |
| 458 return false; | 453 return false; |
| 459 | 454 |
| 460 if (request_.httpBody()) { | 455 if (request_.httpBody()) { |
| 461 // GET and HEAD requests shouldn't have http bodies. | 456 // GET and HEAD requests shouldn't have http bodies. |
| 462 DCHECK(method != "GET" && method != "HEAD"); | 457 DCHECK(method != "GET" && method != "HEAD"); |
| 463 const Vector<FormDataElement>& elements = request_.httpBody()->elements(); | 458 const Vector<FormDataElement>& elements = request_.httpBody()->elements(); |
| 464 size_t n = elements.size(); | 459 size_t n = elements.size(); |
| 465 for (size_t i = 0; i < n; ++i) { | 460 for (size_t i = 0; i < n; ++i) { |
| 466 const FormDataElement& e = elements[static_cast<unsigned>(i)]; | 461 const FormDataElement& e = elements[static_cast<unsigned>(i)]; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 // if the request cannot be serviced from cache. We force the 'DontLoad' | 771 // if the request cannot be serviced from cache. We force the 'DontLoad' |
| 777 // cache policy at this point to ensure that we never hit the network for | 772 // cache policy at this point to ensure that we never hit the network for |
| 778 // this request. | 773 // this request. |
| 779 // | 774 // |
| 780 DCHECK(request.httpMethod() == "POST"); | 775 DCHECK(request.httpMethod() == "POST"); |
| 781 request.setCachePolicy(ReturnCacheDataDontLoad); | 776 request.setCachePolicy(ReturnCacheDataDontLoad); |
| 782 return true; | 777 return true; |
| 783 } | 778 } |
| 784 | 779 |
| 785 } // namespace WebCore | 780 } // namespace WebCore |
| OLD | NEW |