OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/download_resource_handler.h" | 5 #include "chrome/browser/renderer_host/download_resource_handler.h" |
6 | 6 |
7 #include "chrome/browser/download/download_file.h" | 7 #include "chrome/browser/download/download_file.h" |
8 #include "chrome/browser/download/download_manager.h" | 8 #include "chrome/browser/download/download_manager.h" |
9 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 9 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 std::string content_disposition; | 44 std::string content_disposition; |
45 request_->GetResponseHeaderByName("content-disposition", | 45 request_->GetResponseHeaderByName("content-disposition", |
46 &content_disposition); | 46 &content_disposition); |
47 set_content_disposition(content_disposition); | 47 set_content_disposition(content_disposition); |
48 set_content_length(response->response_head.content_length); | 48 set_content_length(response->response_head.content_length); |
49 | 49 |
50 download_id_ = download_manager_->GetNextId(); | 50 download_id_ = download_manager_->GetNextId(); |
51 // |download_manager_| consumes (deletes): | 51 // |download_manager_| consumes (deletes): |
52 DownloadCreateInfo* info = new DownloadCreateInfo; | 52 DownloadCreateInfo* info = new DownloadCreateInfo; |
53 info->url = url_; | 53 info->url = url_; |
| 54 info->referrer_url = GURL(request_->referrer()); |
54 info->start_time = base::Time::Now(); | 55 info->start_time = base::Time::Now(); |
55 info->received_bytes = 0; | 56 info->received_bytes = 0; |
56 info->total_bytes = content_length_; | 57 info->total_bytes = content_length_; |
57 info->state = DownloadItem::IN_PROGRESS; | 58 info->state = DownloadItem::IN_PROGRESS; |
58 info->download_id = download_id_; | 59 info->download_id = download_id_; |
59 info->render_process_id = global_id_.process_id; | 60 info->render_process_id = global_id_.process_id; |
60 info->render_view_id = render_view_id_; | 61 info->render_view_id = render_view_id_; |
61 info->request_id = global_id_.request_id; | 62 info->request_id = global_id_.request_id; |
62 info->content_disposition = content_disposition_; | 63 info->content_disposition = content_disposition_; |
63 info->mime_type = response->response_head.mime_type; | 64 info->mime_type = response->response_head.mime_type; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 should_pause); | 164 should_pause); |
164 is_paused_ = should_pause; | 165 is_paused_ = should_pause; |
165 } | 166 } |
166 } | 167 } |
167 | 168 |
168 void DownloadResourceHandler::StartPauseTimer() { | 169 void DownloadResourceHandler::StartPauseTimer() { |
169 if (!pause_timer_.IsRunning()) | 170 if (!pause_timer_.IsRunning()) |
170 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this, | 171 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this, |
171 &DownloadResourceHandler::CheckWriteProgress); | 172 &DownloadResourceHandler::CheckWriteProgress); |
172 } | 173 } |
OLD | NEW |