| 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->save_as = save_as_ && save_info_.file_path.empty(); | 88 info->prompt_user_for_save_location = |
| 89 save_as_ && save_info_.file_path.empty(); |
| 89 info->is_dangerous = false; | 90 info->is_dangerous = false; |
| 90 info->referrer_charset = request_->context()->referrer_charset(); | 91 info->referrer_charset = request_->context()->referrer_charset(); |
| 91 info->save_info = save_info_; | 92 info->save_info = save_info_; |
| 92 ChromeThread::PostTask( | 93 ChromeThread::PostTask( |
| 93 ChromeThread::FILE, FROM_HERE, | 94 ChromeThread::FILE, FROM_HERE, |
| 94 NewRunnableMethod( | 95 NewRunnableMethod( |
| 95 download_manager_, &DownloadFileManager::StartDownload, info)); | 96 download_manager_, &DownloadFileManager::StartDownload, info)); |
| 96 return true; | 97 return true; |
| 97 } | 98 } |
| 98 | 99 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 should_pause); | 202 should_pause); |
| 202 is_paused_ = should_pause; | 203 is_paused_ = should_pause; |
| 203 } | 204 } |
| 204 } | 205 } |
| 205 | 206 |
| 206 void DownloadResourceHandler::StartPauseTimer() { | 207 void DownloadResourceHandler::StartPauseTimer() { |
| 207 if (!pause_timer_.IsRunning()) | 208 if (!pause_timer_.IsRunning()) |
| 208 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this, | 209 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this, |
| 209 &DownloadResourceHandler::CheckWriteProgress); | 210 &DownloadResourceHandler::CheckWriteProgress); |
| 210 } | 211 } |
| OLD | NEW |