| 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 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" | 5 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/download_resource_handler.h" | 7 #include "chrome/browser/renderer_host/download_resource_handler.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 | 9 |
| 10 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( | 10 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 CopyTmpBufferToDownloadHandler(); | 92 CopyTmpBufferToDownloadHandler(); |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 if (download_handler_.get()) | 95 if (download_handler_.get()) |
| 96 return download_handler_->OnReadCompleted(request_id, bytes_read); | 96 return download_handler_->OnReadCompleted(request_id, bytes_read); |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool DownloadThrottlingResourceHandler::OnResponseCompleted( | 100 bool DownloadThrottlingResourceHandler::OnResponseCompleted( |
| 101 int request_id, | 101 int request_id, |
| 102 const URLRequestStatus& status) { | 102 const URLRequestStatus& status, |
| 103 const std::string& security_info) { |
| 103 if (download_handler_.get()) | 104 if (download_handler_.get()) |
| 104 return download_handler_->OnResponseCompleted(request_id, status); | 105 return download_handler_->OnResponseCompleted(request_id, status, |
| 106 security_info); |
| 105 NOTREACHED(); | 107 NOTREACHED(); |
| 106 return true; | 108 return true; |
| 107 } | 109 } |
| 108 | 110 |
| 109 void DownloadThrottlingResourceHandler::CancelDownload() { | 111 void DownloadThrottlingResourceHandler::CancelDownload() { |
| 110 host_->CancelRequest(render_process_host_id_, request_id_, false); | 112 host_->CancelRequest(render_process_host_id_, request_id_, false); |
| 111 } | 113 } |
| 112 | 114 |
| 113 void DownloadThrottlingResourceHandler::ContinueDownload() { | 115 void DownloadThrottlingResourceHandler::ContinueDownload() { |
| 114 DCHECK(!download_handler_.get()); | 116 DCHECK(!download_handler_.get()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 137 int buf_size; | 139 int buf_size; |
| 138 if (download_handler_->OnWillRead(request_id_, &buffer, &buf_size, | 140 if (download_handler_->OnWillRead(request_id_, &buffer, &buf_size, |
| 139 tmp_buffer_length_)) { | 141 tmp_buffer_length_)) { |
| 140 CHECK(buf_size >= tmp_buffer_length_); | 142 CHECK(buf_size >= tmp_buffer_length_); |
| 141 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); | 143 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); |
| 142 download_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); | 144 download_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); |
| 143 } | 145 } |
| 144 tmp_buffer_length_ = 0; | 146 tmp_buffer_length_ = 0; |
| 145 tmp_buffer_ = NULL; | 147 tmp_buffer_ = NULL; |
| 146 } | 148 } |
| OLD | NEW |