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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 &content_disposition); | 108 &content_disposition); |
109 SetContentDisposition(content_disposition); | 109 SetContentDisposition(content_disposition); |
110 SetContentLength(response->content_length); | 110 SetContentLength(response->content_length); |
111 | 111 |
112 const ResourceRequestInfoImpl* request_info = | 112 const ResourceRequestInfoImpl* request_info = |
113 ResourceRequestInfoImpl::ForRequest(request_); | 113 ResourceRequestInfoImpl::ForRequest(request_); |
114 | 114 |
115 // Deleted in DownloadManager. | 115 // Deleted in DownloadManager. |
116 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo( | 116 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo( |
117 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, | 117 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, |
118 request_->net_log(), request_info->has_user_gesture(), | 118 request_->net_log(), request_info->HasUserGesture(), |
119 request_info->transition_type())); | 119 request_info->transition_type())); |
120 info->url_chain = request_->url_chain(); | 120 info->url_chain = request_->url_chain(); |
121 info->referrer_url = GURL(request_->referrer()); | 121 info->referrer_url = GURL(request_->referrer()); |
122 info->start_time = base::Time::Now(); | 122 info->start_time = base::Time::Now(); |
123 info->received_bytes = save_info_.offset; | 123 info->received_bytes = save_info_.offset; |
124 info->total_bytes = content_length_; | 124 info->total_bytes = content_length_; |
125 info->state = DownloadItem::IN_PROGRESS; | 125 info->state = DownloadItem::IN_PROGRESS; |
126 info->has_user_gesture = request_info->has_user_gesture(); | 126 info->has_user_gesture = request_info->HasUserGesture(); |
127 info->content_disposition = content_disposition_; | 127 info->content_disposition = content_disposition_; |
128 info->mime_type = response->mime_type; | 128 info->mime_type = response->mime_type; |
129 info->remote_address = request_->GetSocketAddress().host(); | 129 info->remote_address = request_->GetSocketAddress().host(); |
130 download_stats::RecordDownloadMimeType(info->mime_type); | 130 download_stats::RecordDownloadMimeType(info->mime_type); |
131 | 131 |
132 DownloadRequestHandle request_handle(this, global_id_.child_id, | 132 DownloadRequestHandle request_handle(this, global_id_.child_id, |
133 render_view_id_, global_id_.request_id); | 133 render_view_id_, global_id_.request_id); |
134 | 134 |
135 // Get the last modified time and etag. | 135 // Get the last modified time and etag. |
136 const net::HttpResponseHeaders* headers = request_->response_headers(); | 136 const net::HttpResponseHeaders* headers = request_->response_headers(); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 if (download_id_ == DownloadId::Invalid()) | 495 if (download_id_ == DownloadId::Invalid()) |
496 return; | 496 return; |
497 if (buffer_.get() && (buffer_->size() > kLoadsToWrite)) | 497 if (buffer_.get() && (buffer_->size() > kLoadsToWrite)) |
498 return; | 498 return; |
499 | 499 |
500 was_deferred_ = false; | 500 was_deferred_ = false; |
501 ResourceDispatcherHostImpl::Get()->ResumeDeferredRequest( | 501 ResourceDispatcherHostImpl::Get()->ResumeDeferredRequest( |
502 global_id_.child_id, | 502 global_id_.child_id, |
503 global_id_.request_id); | 503 global_id_.request_id); |
504 } | 504 } |
OLD | NEW |