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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 &content_disposition); | 82 &content_disposition); |
83 set_content_disposition(content_disposition); | 83 set_content_disposition(content_disposition); |
84 set_content_length(response->response_head.content_length); | 84 set_content_length(response->response_head.content_length); |
85 | 85 |
86 const ResourceDispatcherHostRequestInfo* request_info = | 86 const ResourceDispatcherHostRequestInfo* request_info = |
87 ResourceDispatcherHost::InfoForRequest(request_); | 87 ResourceDispatcherHost::InfoForRequest(request_); |
88 | 88 |
89 // Deleted in DownloadManager. | 89 // Deleted in DownloadManager. |
90 DownloadCreateInfo* info = new DownloadCreateInfo(FilePath(), GURL(), | 90 DownloadCreateInfo* info = new DownloadCreateInfo(FilePath(), GURL(), |
91 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, | 91 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, |
92 download_id_.local(), request_info->has_user_gesture(), | 92 download_id_, request_info->has_user_gesture(), |
93 request_info->transition_type()); | 93 request_info->transition_type()); |
94 info->url_chain = request_->url_chain(); | 94 info->url_chain = request_->url_chain(); |
95 info->referrer_url = GURL(request_->referrer()); | 95 info->referrer_url = GURL(request_->referrer()); |
96 info->start_time = base::Time::Now(); | 96 info->start_time = base::Time::Now(); |
97 info->received_bytes = 0; | 97 info->received_bytes = 0; |
98 info->total_bytes = content_length_; | 98 info->total_bytes = content_length_; |
99 info->state = DownloadItem::IN_PROGRESS; | 99 info->state = DownloadItem::IN_PROGRESS; |
100 info->download_id = download_id_.local(); | 100 info->download_id = download_id_; |
101 info->has_user_gesture = request_info->has_user_gesture(); | 101 info->has_user_gesture = request_info->has_user_gesture(); |
102 info->content_disposition = content_disposition_; | 102 info->content_disposition = content_disposition_; |
103 info->mime_type = response->response_head.mime_type; | 103 info->mime_type = response->response_head.mime_type; |
104 download_stats::RecordDownloadMimeType(info->mime_type); | 104 download_stats::RecordDownloadMimeType(info->mime_type); |
105 | 105 |
106 DownloadRequestHandle request_handle(rdh_, global_id_.child_id, | 106 DownloadRequestHandle request_handle(rdh_, global_id_.child_id, |
107 render_view_id_, global_id_.request_id); | 107 render_view_id_, global_id_.request_id); |
108 | 108 |
109 // TODO(ahendrickson) -- Get the last modified time and etag, so we can | 109 // TODO(ahendrickson) -- Get the last modified time and etag, so we can |
110 // resume downloading. | 110 // resume downloading. |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 " render_view_id_ = " "%d" | 287 " render_view_id_ = " "%d" |
288 " save_info_.file_path = \"%" PRFilePath "\"" | 288 " save_info_.file_path = \"%" PRFilePath "\"" |
289 " }", | 289 " }", |
290 request_->url().spec().c_str(), | 290 request_->url().spec().c_str(), |
291 download_id_.local(), | 291 download_id_.local(), |
292 global_id_.child_id, | 292 global_id_.child_id, |
293 global_id_.request_id, | 293 global_id_.request_id, |
294 render_view_id_, | 294 render_view_id_, |
295 save_info_.file_path.value().c_str()); | 295 save_info_.file_path.value().c_str()); |
296 } | 296 } |
OLD | NEW |