| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/download_resource_handler.h" | 5 #include "content/browser/download/download_resource_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 &content_disposition); | 113 &content_disposition); |
| 114 SetContentDisposition(content_disposition); | 114 SetContentDisposition(content_disposition); |
| 115 SetContentLength(response->content_length); | 115 SetContentLength(response->content_length); |
| 116 | 116 |
| 117 const ResourceRequestInfoImpl* request_info = | 117 const ResourceRequestInfoImpl* request_info = |
| 118 ResourceRequestInfoImpl::ForRequest(request_); | 118 ResourceRequestInfoImpl::ForRequest(request_); |
| 119 | 119 |
| 120 // Deleted in DownloadManager. | 120 // Deleted in DownloadManager. |
| 121 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo( | 121 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo( |
| 122 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, | 122 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, |
| 123 request_->net_log(), request_info->has_user_gesture(), | 123 request_->net_log(), request_info->HasUserGesture(), |
| 124 request_info->transition_type())); | 124 request_info->transition_type())); |
| 125 info->url_chain = request_->url_chain(); | 125 info->url_chain = request_->url_chain(); |
| 126 info->referrer_url = GURL(request_->referrer()); | 126 info->referrer_url = GURL(request_->referrer()); |
| 127 info->start_time = base::Time::Now(); | 127 info->start_time = base::Time::Now(); |
| 128 info->received_bytes = save_info_.offset; | 128 info->received_bytes = save_info_.offset; |
| 129 info->total_bytes = content_length_; | 129 info->total_bytes = content_length_; |
| 130 info->state = DownloadItem::IN_PROGRESS; | 130 info->state = DownloadItem::IN_PROGRESS; |
| 131 info->has_user_gesture = request_info->has_user_gesture(); | 131 info->has_user_gesture = request_info->HasUserGesture(); |
| 132 info->content_disposition = content_disposition_; | 132 info->content_disposition = content_disposition_; |
| 133 info->mime_type = response->mime_type; | 133 info->mime_type = response->mime_type; |
| 134 info->remote_address = request_->GetSocketAddress().host(); | 134 info->remote_address = request_->GetSocketAddress().host(); |
| 135 download_stats::RecordDownloadMimeType(info->mime_type); | 135 download_stats::RecordDownloadMimeType(info->mime_type); |
| 136 | 136 |
| 137 DownloadRequestHandle request_handle(this, global_id_.child_id, | 137 DownloadRequestHandle request_handle(this, global_id_.child_id, |
| 138 render_view_id_, global_id_.request_id); | 138 render_view_id_, global_id_.request_id); |
| 139 | 139 |
| 140 // Get the last modified time and etag. | 140 // Get the last modified time and etag. |
| 141 const net::HttpResponseHeaders* headers = request_->response_headers(); | 141 const net::HttpResponseHeaders* headers = request_->response_headers(); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 if (download_id_ == DownloadId::Invalid()) | 500 if (download_id_ == DownloadId::Invalid()) |
| 501 return; | 501 return; |
| 502 if (buffer_.get() && (buffer_->size() > kLoadsToWrite)) | 502 if (buffer_.get() && (buffer_->size() > kLoadsToWrite)) |
| 503 return; | 503 return; |
| 504 | 504 |
| 505 was_deferred_ = false; | 505 was_deferred_ = false; |
| 506 ResourceDispatcherHostImpl::Get()->ResumeDeferredRequest( | 506 ResourceDispatcherHostImpl::Get()->ResumeDeferredRequest( |
| 507 global_id_.child_id, | 507 global_id_.child_id, |
| 508 global_id_.request_id); | 508 global_id_.request_id); |
| 509 } | 509 } |
| OLD | NEW |