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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 &content_disposition); | 79 &content_disposition); |
80 set_content_disposition(content_disposition); | 80 set_content_disposition(content_disposition); |
81 set_content_length(response->response_head.content_length); | 81 set_content_length(response->response_head.content_length); |
82 | 82 |
83 const ResourceDispatcherHostRequestInfo* request_info = | 83 const ResourceDispatcherHostRequestInfo* request_info = |
84 ResourceDispatcherHost::InfoForRequest(request_); | 84 ResourceDispatcherHost::InfoForRequest(request_); |
85 | 85 |
86 // Deleted in DownloadManager. | 86 // Deleted in DownloadManager. |
87 DownloadCreateInfo* info = new DownloadCreateInfo(FilePath(), GURL(), | 87 DownloadCreateInfo* info = new DownloadCreateInfo(FilePath(), GURL(), |
88 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, | 88 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, |
89 download_id_.local(), request_info->has_user_gesture(), | 89 download_id_, request_info->has_user_gesture(), |
90 request_info->transition_type()); | 90 request_info->transition_type()); |
91 info->url_chain = request_->url_chain(); | 91 info->url_chain = request_->url_chain(); |
92 info->referrer_url = GURL(request_->referrer()); | 92 info->referrer_url = GURL(request_->referrer()); |
93 info->start_time = base::Time::Now(); | 93 info->start_time = base::Time::Now(); |
94 info->received_bytes = 0; | 94 info->received_bytes = 0; |
95 info->total_bytes = content_length_; | 95 info->total_bytes = content_length_; |
96 info->state = DownloadItem::IN_PROGRESS; | 96 info->state = DownloadItem::IN_PROGRESS; |
97 info->download_id = download_id_.local(); | 97 info->download_id = download_id_; |
98 info->has_user_gesture = request_info->has_user_gesture(); | 98 info->has_user_gesture = request_info->has_user_gesture(); |
99 info->request_handle = DownloadRequestHandle(rdh_, | 99 info->request_handle = DownloadRequestHandle(rdh_, |
100 global_id_.child_id, | 100 global_id_.child_id, |
101 render_view_id_, | 101 render_view_id_, |
102 global_id_.request_id); | 102 global_id_.request_id); |
103 info->content_disposition = content_disposition_; | 103 info->content_disposition = content_disposition_; |
104 info->mime_type = response->response_head.mime_type; | 104 info->mime_type = response->response_head.mime_type; |
105 download_stats::RecordDownloadMimeType(info->mime_type); | 105 download_stats::RecordDownloadMimeType(info->mime_type); |
106 // TODO(ahendrickson) -- Get the last modified time and etag, so we can | 106 // TODO(ahendrickson) -- Get the last modified time and etag, so we can |
107 // resume downloading. | 107 // resume downloading. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 " render_view_id_ = " "%d" | 276 " render_view_id_ = " "%d" |
277 " save_info_.file_path = \"%" PRFilePath "\"" | 277 " save_info_.file_path = \"%" PRFilePath "\"" |
278 " }", | 278 " }", |
279 request_->url().spec().c_str(), | 279 request_->url().spec().c_str(), |
280 download_id_.local(), | 280 download_id_.local(), |
281 global_id_.child_id, | 281 global_id_.child_id, |
282 global_id_.request_id, | 282 global_id_.request_id, |
283 render_view_id_, | 283 render_view_id_, |
284 save_info_.file_path.value().c_str()); | 284 save_info_.file_path.value().c_str()); |
285 } | 285 } |
OLD | NEW |