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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
9 #include "chrome/browser/download/download_item.h" | 9 #include "chrome/browser/download/download_item.h" |
10 #include "chrome/browser/download/download_file_manager.h" | 10 #include "chrome/browser/download/download_file_manager.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 info->request_id = global_id_.request_id; | 78 info->request_id = global_id_.request_id; |
79 info->content_disposition = content_disposition_; | 79 info->content_disposition = content_disposition_; |
80 info->mime_type = response->response_head.mime_type; | 80 info->mime_type = response->response_head.mime_type; |
81 | 81 |
82 std::string content_type_header; | 82 std::string content_type_header; |
83 if (!response->response_head.headers || | 83 if (!response->response_head.headers || |
84 !response->response_head.headers->GetMimeType(&content_type_header)) | 84 !response->response_head.headers->GetMimeType(&content_type_header)) |
85 content_type_header = ""; | 85 content_type_header = ""; |
86 info->original_mime_type = content_type_header; | 86 info->original_mime_type = content_type_header; |
87 | 87 |
88 info->prompt_user_for_save_location = | 88 info->save_as = save_as_ && save_info_.file_path.empty(); |
89 save_as_ && save_info_.file_path.empty(); | |
90 info->is_dangerous = false; | 89 info->is_dangerous = false; |
91 info->referrer_charset = request_->context()->referrer_charset(); | 90 info->referrer_charset = request_->context()->referrer_charset(); |
92 info->save_info = save_info_; | 91 info->save_info = save_info_; |
93 ChromeThread::PostTask( | 92 ChromeThread::PostTask( |
94 ChromeThread::FILE, FROM_HERE, | 93 ChromeThread::FILE, FROM_HERE, |
95 NewRunnableMethod( | 94 NewRunnableMethod( |
96 download_manager_, &DownloadFileManager::StartDownload, info)); | 95 download_manager_, &DownloadFileManager::StartDownload, info)); |
97 return true; | 96 return true; |
98 } | 97 } |
99 | 98 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 should_pause); | 201 should_pause); |
203 is_paused_ = should_pause; | 202 is_paused_ = should_pause; |
204 } | 203 } |
205 } | 204 } |
206 | 205 |
207 void DownloadResourceHandler::StartPauseTimer() { | 206 void DownloadResourceHandler::StartPauseTimer() { |
208 if (!pause_timer_.IsRunning()) | 207 if (!pause_timer_.IsRunning()) |
209 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this, | 208 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this, |
210 &DownloadResourceHandler::CheckWriteProgress); | 209 &DownloadResourceHandler::CheckWriteProgress); |
211 } | 210 } |
OLD | NEW |