OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 &content_disposition); | 73 &content_disposition); |
74 set_content_disposition(content_disposition); | 74 set_content_disposition(content_disposition); |
75 set_content_length(response->response_head.content_length); | 75 set_content_length(response->response_head.content_length); |
76 | 76 |
77 const ResourceDispatcherHostRequestInfo* request_info = | 77 const ResourceDispatcherHostRequestInfo* request_info = |
78 ResourceDispatcherHost::InfoForRequest(request_); | 78 ResourceDispatcherHost::InfoForRequest(request_); |
79 | 79 |
80 download_id_ = download_file_manager_->GetNextId(); | 80 download_id_ = download_file_manager_->GetNextId(); |
81 | 81 |
82 // Deleted in DownloadManager. | 82 // Deleted in DownloadManager. |
83 DownloadCreateInfo* info = new DownloadCreateInfo; | 83 DownloadCreateInfo* info = new DownloadCreateInfo(FilePath(), GURL(), |
| 84 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, |
| 85 download_id_, request_info->has_user_gesture(), |
| 86 request_info->transition_type()); |
84 info->url_chain = request_->url_chain(); | 87 info->url_chain = request_->url_chain(); |
85 info->referrer_url = GURL(request_->referrer()); | 88 info->referrer_url = GURL(request_->referrer()); |
86 info->start_time = base::Time::Now(); | |
87 info->received_bytes = 0; | |
88 info->total_bytes = content_length_; | |
89 info->state = DownloadItem::IN_PROGRESS; | |
90 info->download_id = download_id_; | |
91 info->has_user_gesture = request_info->has_user_gesture(); | |
92 info->request_handle = DownloadRequestHandle(rdh_, | 89 info->request_handle = DownloadRequestHandle(rdh_, |
93 global_id_.child_id, | 90 global_id_.child_id, |
94 render_view_id_, | 91 render_view_id_, |
95 global_id_.request_id); | 92 global_id_.request_id); |
96 info->content_disposition = content_disposition_; | 93 info->content_disposition = content_disposition_; |
97 info->mime_type = response->response_head.mime_type; | 94 info->mime_type = response->response_head.mime_type; |
98 download_util::RecordDownloadMimeType(info->mime_type); | 95 download_util::RecordDownloadMimeType(info->mime_type); |
99 // TODO(ahendrickson) -- Get the last modified time and etag, so we can | 96 // TODO(ahendrickson) -- Get the last modified time and etag, so we can |
100 // resume downloading. | 97 // resume downloading. |
101 | 98 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 " render_view_id_ = " "%d" | 253 " render_view_id_ = " "%d" |
257 " save_info_.file_path = \"%" PRFilePath "\"" | 254 " save_info_.file_path = \"%" PRFilePath "\"" |
258 " }", | 255 " }", |
259 request_->url().spec().c_str(), | 256 request_->url().spec().c_str(), |
260 download_id_, | 257 download_id_, |
261 global_id_.child_id, | 258 global_id_.child_id, |
262 global_id_.request_id, | 259 global_id_.request_id, |
263 render_view_id_, | 260 render_view_id_, |
264 save_info_.file_path.value().c_str()); | 261 save_info_.file_path.value().c_str()); |
265 } | 262 } |
OLD | NEW |