Chromium Code Reviews| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 | 219 |
| 220 // Used to suspend/resume an asynchronous load. | 220 // Used to suspend/resume an asynchronous load. |
| 221 void SetDefersLoading(bool value); | 221 void SetDefersLoading(bool value); |
| 222 | 222 |
| 223 // ResourceLoaderBridge::Peer implementation | 223 // ResourceLoaderBridge::Peer implementation |
| 224 virtual void OnReceivedRedirect(const GURL& new_url); | 224 virtual void OnReceivedRedirect(const GURL& new_url); |
| 225 virtual void OnReceivedResponse( | 225 virtual void OnReceivedResponse( |
| 226 const ResourceLoaderBridge::ResponseInfo& info, | 226 const ResourceLoaderBridge::ResponseInfo& info, |
| 227 bool content_filtered); | 227 bool content_filtered); |
| 228 virtual void OnReceivedData(const char* data, int len); | 228 virtual void OnReceivedData(const char* data, int len); |
| 229 virtual void OnCompletedRequest(const URLRequestStatus& status); | 229 virtual void OnCompletedRequest(const URLRequestStatus& status, |
| 230 const std::string& security_info); | |
| 230 virtual std::string GetURLForDebugging(); | 231 virtual std::string GetURLForDebugging(); |
| 231 | 232 |
| 232 // Handles a data: url internally instead of calling the bridge. | 233 // Handles a data: url internally instead of calling the bridge. |
| 233 void HandleDataUrl(); | 234 void HandleDataUrl(); |
| 234 | 235 |
| 235 // This is the bridge implemented by the embedder. | 236 // This is the bridge implemented by the embedder. |
| 236 // The bridge is kept alive as long as the request is valid and we | 237 // The bridge is kept alive as long as the request is valid and we |
| 237 // are ready for callbacks. | 238 // are ready for callbacks. |
| 238 scoped_ptr<ResourceLoaderBridge> bridge_; | 239 scoped_ptr<ResourceLoaderBridge> bridge_; |
| 239 | 240 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 std::string data; | 292 std::string data; |
| 292 | 293 |
| 293 if (GetInfoFromDataUrl(webkit_glue::KURLToGURL(request_.url()), &info, &data, | 294 if (GetInfoFromDataUrl(webkit_glue::KURLToGURL(request_.url()), &info, &data, |
| 294 &status)) { | 295 &status)) { |
| 295 OnReceivedResponse(info, false); | 296 OnReceivedResponse(info, false); |
| 296 | 297 |
| 297 if (data.size()) | 298 if (data.size()) |
| 298 OnReceivedData(data.c_str(), data.size()); | 299 OnReceivedData(data.c_str(), data.size()); |
| 299 } | 300 } |
| 300 | 301 |
| 301 OnCompletedRequest(status); | 302 OnCompletedRequest(status, info.security_info); |
| 302 | 303 |
| 303 // We are done using the object. ResourceHandle and ResourceHandleInternal | 304 // We are done using the object. ResourceHandle and ResourceHandleInternal |
| 304 // might be destroyed now. | 305 // might be destroyed now. |
| 305 job_->deref(); | 306 job_->deref(); |
| 306 } | 307 } |
| 307 | 308 |
| 308 bool ResourceHandleInternal::Start( | 309 bool ResourceHandleInternal::Start( |
| 309 ResourceLoaderBridge::SyncLoadResponse* sync_load_response) { | 310 ResourceLoaderBridge::SyncLoadResponse* sync_load_response) { |
| 310 DCHECK(!bridge_.get()); | 311 DCHECK(!bridge_.get()); |
| 311 | 312 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 596 client_->didReceiveData(job_, data, data_len, lengthReceived); | 597 client_->didReceiveData(job_, data, data_len, lengthReceived); |
| 597 } else { | 598 } else { |
| 598 // AddData will make the appropriate calls to client_->didReceiveData | 599 // AddData will make the appropriate calls to client_->didReceiveData |
| 599 // and client_->didReceiveResponse | 600 // and client_->didReceiveResponse |
| 600 multipart_delegate_->OnReceivedData(data, data_len); | 601 multipart_delegate_->OnReceivedData(data, data_len); |
| 601 } | 602 } |
| 602 } | 603 } |
| 603 } | 604 } |
| 604 | 605 |
| 605 void ResourceHandleInternal::OnCompletedRequest( | 606 void ResourceHandleInternal::OnCompletedRequest( |
| 606 const URLRequestStatus& status) { | 607 const URLRequestStatus& status, |
| 608 const std::string& security_info) { | |
|
darin (slow to review)
2009/03/04 19:29:01
i don't see us doing anything with this security_i
jcampan
2009/03/04 22:33:43
It's now part of the peer interface.
the security
| |
| 607 if (multipart_delegate_.get()) { | 609 if (multipart_delegate_.get()) { |
| 608 multipart_delegate_->OnCompletedRequest(); | 610 multipart_delegate_->OnCompletedRequest(); |
| 609 multipart_delegate_.reset(NULL); | 611 multipart_delegate_.reset(NULL); |
| 610 } | 612 } |
| 611 | 613 |
| 612 pending_ = false; | 614 pending_ = false; |
| 613 | 615 |
| 614 if (client_) { | 616 if (client_) { |
| 615 if (status.status() != URLRequestStatus::SUCCESS) { | 617 if (status.status() != URLRequestStatus::SUCCESS) { |
| 616 int error_code; | 618 int error_code; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 // if the request cannot be serviced from cache. We force the 'DontLoad' | 766 // if the request cannot be serviced from cache. We force the 'DontLoad' |
| 765 // cache policy at this point to ensure that we never hit the network for | 767 // cache policy at this point to ensure that we never hit the network for |
| 766 // this request. | 768 // this request. |
| 767 // | 769 // |
| 768 DCHECK(request.httpMethod() == "POST"); | 770 DCHECK(request.httpMethod() == "POST"); |
| 769 request.setCachePolicy(ReturnCacheDataDontLoad); | 771 request.setCachePolicy(ReturnCacheDataDontLoad); |
| 770 return true; | 772 return true; |
| 771 } | 773 } |
| 772 | 774 |
| 773 } // namespace WebCore | 775 } // namespace WebCore |
| OLD | NEW |