| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return true; | 174 return true; |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool DownloadResourceHandler::OnResponseCompleted( | 177 bool DownloadResourceHandler::OnResponseCompleted( |
| 178 int request_id, | 178 int request_id, |
| 179 const net::URLRequestStatus& status, | 179 const net::URLRequestStatus& status, |
| 180 const std::string& security_info) { | 180 const std::string& security_info) { |
| 181 VLOG(20) << __FUNCTION__ << "()" << DebugString() | 181 VLOG(20) << __FUNCTION__ << "()" << DebugString() |
| 182 << " request_id = " << request_id | 182 << " request_id = " << request_id |
| 183 << " status.status() = " << status.status() | 183 << " status.status() = " << status.status() |
| 184 << " status.os_error() = " << status.os_error(); | 184 << " status.error() = " << status.error(); |
| 185 net::Error error_code = (status.status() == net::URLRequestStatus::FAILED) ? | 185 net::Error error_code = (status.status() == net::URLRequestStatus::FAILED) ? |
| 186 static_cast<net::Error>(status.os_error()) : net::OK; | 186 static_cast<net::Error>(status.error()) : net::OK; |
| 187 // We transfer ownership to |DownloadFileManager| to delete |buffer_|, | 187 // We transfer ownership to |DownloadFileManager| to delete |buffer_|, |
| 188 // so that any functions queued up on the FILE thread are executed | 188 // so that any functions queued up on the FILE thread are executed |
| 189 // before deletion. | 189 // before deletion. |
| 190 BrowserThread::PostTask( | 190 BrowserThread::PostTask( |
| 191 BrowserThread::FILE, FROM_HERE, | 191 BrowserThread::FILE, FROM_HERE, |
| 192 NewRunnableMethod(download_file_manager_, | 192 NewRunnableMethod(download_file_manager_, |
| 193 &DownloadFileManager::OnResponseCompleted, | 193 &DownloadFileManager::OnResponseCompleted, |
| 194 download_id_, | 194 download_id_, |
| 195 buffer_.release(), | 195 buffer_.release(), |
| 196 error_code, | 196 error_code, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 " render_view_id_ = " "%d" | 262 " render_view_id_ = " "%d" |
| 263 " save_info_.file_path = \"%" PRFilePath "\"" | 263 " save_info_.file_path = \"%" PRFilePath "\"" |
| 264 " }", | 264 " }", |
| 265 request_->url().spec().c_str(), | 265 request_->url().spec().c_str(), |
| 266 download_id_.local(), | 266 download_id_.local(), |
| 267 global_id_.child_id, | 267 global_id_.child_id, |
| 268 global_id_.request_id, | 268 global_id_.request_id, |
| 269 render_view_id_, | 269 render_view_id_, |
| 270 save_info_.file_path.value().c_str()); | 270 save_info_.file_path.value().c_str()); |
| 271 } | 271 } |
| OLD | NEW |