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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 &content_disposition); | 106 &content_disposition); |
107 set_content_disposition(content_disposition); | 107 set_content_disposition(content_disposition); |
108 set_content_length(response->content_length); | 108 set_content_length(response->content_length); |
109 | 109 |
110 const ResourceRequestInfoImpl* request_info = | 110 const ResourceRequestInfoImpl* request_info = |
111 ResourceRequestInfoImpl::ForRequest(request_); | 111 ResourceRequestInfoImpl::ForRequest(request_); |
112 | 112 |
113 // Deleted in DownloadManager. | 113 // Deleted in DownloadManager. |
114 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo( | 114 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo( |
115 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, | 115 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, |
116 request_->net_log(), request_info->has_user_gesture(), | 116 request_->net_log(), request_info->HasUserGesture(), |
117 request_info->transition_type())); | 117 request_info->transition_type())); |
118 info->url_chain = request_->url_chain(); | 118 info->url_chain = request_->url_chain(); |
119 info->referrer_url = GURL(request_->referrer()); | 119 info->referrer_url = GURL(request_->referrer()); |
120 info->start_time = base::Time::Now(); | 120 info->start_time = base::Time::Now(); |
121 info->received_bytes = save_info_.offset; | 121 info->received_bytes = save_info_.offset; |
122 info->total_bytes = content_length_; | 122 info->total_bytes = content_length_; |
123 info->state = DownloadItem::IN_PROGRESS; | 123 info->state = DownloadItem::IN_PROGRESS; |
124 info->has_user_gesture = request_info->has_user_gesture(); | 124 info->has_user_gesture = request_info->HasUserGesture(); |
125 info->content_disposition = content_disposition_; | 125 info->content_disposition = content_disposition_; |
126 info->mime_type = response->mime_type; | 126 info->mime_type = response->mime_type; |
127 info->remote_address = request_->GetSocketAddress().host(); | 127 info->remote_address = request_->GetSocketAddress().host(); |
128 download_stats::RecordDownloadMimeType(info->mime_type); | 128 download_stats::RecordDownloadMimeType(info->mime_type); |
129 | 129 |
130 DownloadRequestHandle request_handle(global_id_.child_id, | 130 DownloadRequestHandle request_handle(global_id_.child_id, |
131 render_view_id_, global_id_.request_id); | 131 render_view_id_, global_id_.request_id); |
132 | 132 |
133 // Get the last modified time and etag. | 133 // Get the last modified time and etag. |
134 const net::HttpResponseHeaders* headers = request_->response_headers(); | 134 const net::HttpResponseHeaders* headers = request_->response_headers(); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 " }", | 433 " }", |
434 request_ ? | 434 request_ ? |
435 request_->url().spec().c_str() : | 435 request_->url().spec().c_str() : |
436 "<NULL request>", | 436 "<NULL request>", |
437 download_id_.local(), | 437 download_id_.local(), |
438 global_id_.child_id, | 438 global_id_.child_id, |
439 global_id_.request_id, | 439 global_id_.request_id, |
440 render_view_id_, | 440 render_view_id_, |
441 save_info_.file_path.value().c_str()); | 441 save_info_.file_path.value().c_str()); |
442 } | 442 } |
OLD | NEW |