OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
6 | 6 |
7 #include "webkit/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 ~Context() {} | 277 ~Context() {} |
278 | 278 |
279 void HandleDataURL(); | 279 void HandleDataURL(); |
280 | 280 |
281 WebURLLoaderImpl* loader_; | 281 WebURLLoaderImpl* loader_; |
282 WebURLRequest request_; | 282 WebURLRequest request_; |
283 WebURLLoaderClient* client_; | 283 WebURLLoaderClient* client_; |
284 scoped_ptr<ResourceLoaderBridge> bridge_; | 284 scoped_ptr<ResourceLoaderBridge> bridge_; |
285 scoped_ptr<FtpDirectoryListingResponseDelegate> ftp_listing_delegate_; | 285 scoped_ptr<FtpDirectoryListingResponseDelegate> ftp_listing_delegate_; |
286 scoped_ptr<MultipartResponseDelegate> multipart_delegate_; | 286 scoped_ptr<MultipartResponseDelegate> multipart_delegate_; |
| 287 scoped_ptr<ResourceLoaderBridge> completed_bridge_; |
287 | 288 |
288 // TODO(japhet): Storing this is a temporary hack for site isolation logging. | 289 // TODO(japhet): Storing this is a temporary hack for site isolation logging. |
289 WebURL response_url_; | 290 WebURL response_url_; |
290 }; | 291 }; |
291 | 292 |
292 WebURLLoaderImpl::Context::Context(WebURLLoaderImpl* loader) | 293 WebURLLoaderImpl::Context::Context(WebURLLoaderImpl* loader) |
293 : loader_(loader), | 294 : loader_(loader), |
294 client_(NULL) { | 295 client_(NULL) { |
295 } | 296 } |
296 | 297 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 const std::string& security_info, | 592 const std::string& security_info, |
592 const base::Time& completion_time) { | 593 const base::Time& completion_time) { |
593 if (ftp_listing_delegate_.get()) { | 594 if (ftp_listing_delegate_.get()) { |
594 ftp_listing_delegate_->OnCompletedRequest(); | 595 ftp_listing_delegate_->OnCompletedRequest(); |
595 ftp_listing_delegate_.reset(NULL); | 596 ftp_listing_delegate_.reset(NULL); |
596 } else if (multipart_delegate_.get()) { | 597 } else if (multipart_delegate_.get()) { |
597 multipart_delegate_->OnCompletedRequest(); | 598 multipart_delegate_->OnCompletedRequest(); |
598 multipart_delegate_.reset(NULL); | 599 multipart_delegate_.reset(NULL); |
599 } | 600 } |
600 | 601 |
601 // Prevent any further IPC to the browser now that we're complete. | 602 // Prevent any further IPC to the browser now that we're complete, but |
602 bridge_.reset(); | 603 // don't delete it to keep any downloaded temp files alive. |
| 604 DCHECK(!completed_bridge_.get()); |
| 605 completed_bridge_.swap(bridge_); |
603 | 606 |
604 if (client_) { | 607 if (client_) { |
605 if (status.status() != URLRequestStatus::SUCCESS) { | 608 if (status.status() != URLRequestStatus::SUCCESS) { |
606 int error_code; | 609 int error_code; |
607 if (status.status() == URLRequestStatus::HANDLED_EXTERNALLY) { | 610 if (status.status() == URLRequestStatus::HANDLED_EXTERNALLY) { |
608 // By marking this request as aborted we insure that we don't navigate | 611 // By marking this request as aborted we insure that we don't navigate |
609 // to an error page. | 612 // to an error page. |
610 error_code = net::ERR_ABORTED; | 613 error_code = net::ERR_ABORTED; |
611 } else { | 614 } else { |
612 error_code = status.os_error(); | 615 error_code = status.os_error(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 698 |
696 void WebURLLoaderImpl::cancel() { | 699 void WebURLLoaderImpl::cancel() { |
697 context_->Cancel(); | 700 context_->Cancel(); |
698 } | 701 } |
699 | 702 |
700 void WebURLLoaderImpl::setDefersLoading(bool value) { | 703 void WebURLLoaderImpl::setDefersLoading(bool value) { |
701 context_->SetDefersLoading(value); | 704 context_->SetDefersLoading(value); |
702 } | 705 } |
703 | 706 |
704 } // namespace webkit_glue | 707 } // namespace webkit_glue |
OLD | NEW |