| 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_; | |
| 288 | 287 |
| 289 // TODO(japhet): Storing this is a temporary hack for site isolation logging. | 288 // TODO(japhet): Storing this is a temporary hack for site isolation logging. |
| 290 WebURL response_url_; | 289 WebURL response_url_; |
| 291 }; | 290 }; |
| 292 | 291 |
| 293 WebURLLoaderImpl::Context::Context(WebURLLoaderImpl* loader) | 292 WebURLLoaderImpl::Context::Context(WebURLLoaderImpl* loader) |
| 294 : loader_(loader), | 293 : loader_(loader), |
| 295 client_(NULL) { | 294 client_(NULL) { |
| 296 } | 295 } |
| 297 | 296 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 const std::string& security_info, | 591 const std::string& security_info, |
| 593 const base::Time& completion_time) { | 592 const base::Time& completion_time) { |
| 594 if (ftp_listing_delegate_.get()) { | 593 if (ftp_listing_delegate_.get()) { |
| 595 ftp_listing_delegate_->OnCompletedRequest(); | 594 ftp_listing_delegate_->OnCompletedRequest(); |
| 596 ftp_listing_delegate_.reset(NULL); | 595 ftp_listing_delegate_.reset(NULL); |
| 597 } else if (multipart_delegate_.get()) { | 596 } else if (multipart_delegate_.get()) { |
| 598 multipart_delegate_->OnCompletedRequest(); | 597 multipart_delegate_->OnCompletedRequest(); |
| 599 multipart_delegate_.reset(NULL); | 598 multipart_delegate_.reset(NULL); |
| 600 } | 599 } |
| 601 | 600 |
| 602 // Prevent any further IPC to the browser now that we're complete, but | 601 // Prevent any further IPC to the browser now that we're complete. |
| 603 // don't delete it to keep any downloaded temp files alive. | 602 bridge_.reset(); |
| 604 DCHECK(!completed_bridge_.get()); | |
| 605 completed_bridge_.swap(bridge_); | |
| 606 | 603 |
| 607 if (client_) { | 604 if (client_) { |
| 608 if (status.status() != URLRequestStatus::SUCCESS) { | 605 if (status.status() != URLRequestStatus::SUCCESS) { |
| 609 int error_code; | 606 int error_code; |
| 610 if (status.status() == URLRequestStatus::HANDLED_EXTERNALLY) { | 607 if (status.status() == URLRequestStatus::HANDLED_EXTERNALLY) { |
| 611 // By marking this request as aborted we insure that we don't navigate | 608 // By marking this request as aborted we insure that we don't navigate |
| 612 // to an error page. | 609 // to an error page. |
| 613 error_code = net::ERR_ABORTED; | 610 error_code = net::ERR_ABORTED; |
| 614 } else { | 611 } else { |
| 615 error_code = status.os_error(); | 612 error_code = status.os_error(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 | 695 |
| 699 void WebURLLoaderImpl::cancel() { | 696 void WebURLLoaderImpl::cancel() { |
| 700 context_->Cancel(); | 697 context_->Cancel(); |
| 701 } | 698 } |
| 702 | 699 |
| 703 void WebURLLoaderImpl::setDefersLoading(bool value) { | 700 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 704 context_->SetDefersLoading(value); | 701 context_->SetDefersLoading(value); |
| 705 } | 702 } |
| 706 | 703 |
| 707 } // namespace webkit_glue | 704 } // namespace webkit_glue |
| OLD | NEW |