| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 return true; | 289 return true; |
| 290 } | 290 } |
| 291 | 291 |
| 292 void DownloadResourceHandler::OnRequestClosed() { | 292 void DownloadResourceHandler::OnRequestClosed() { |
| 293 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", | 293 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", |
| 294 base::TimeTicks::Now() - download_start_time_); | 294 base::TimeTicks::Now() - download_start_time_); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void DownloadResourceHandler::StartOnUIThread( | 297 void DownloadResourceHandler::StartOnUIThread( |
| 298 scoped_ptr<DownloadCreateInfo> info, | 298 scoped_ptr<DownloadCreateInfo> info, |
| 299 DownloadRequestHandle handle) { | 299 const DownloadRequestHandle& handle) { |
| 300 DownloadManager* download_manager = handle.GetDownloadManager(); | 300 DownloadManager* download_manager = handle.GetDownloadManager(); |
| 301 if (!download_manager) { | 301 if (!download_manager) { |
| 302 // NULL in unittests or if the page closed right after starting the | 302 // NULL in unittests or if the page closed right after starting the |
| 303 // download. | 303 // download. |
| 304 return; | 304 return; |
| 305 } | 305 } |
| 306 info->download_id = download_manager->delegate()->GetNextId(); | 306 info->download_id = download_manager->delegate()->GetNextId(); |
| 307 BrowserThread::PostTask( | 307 BrowserThread::PostTask( |
| 308 BrowserThread::IO, FROM_HERE, | 308 BrowserThread::IO, FROM_HERE, |
| 309 base::Bind(&DownloadResourceHandler::set_download_id, this, | 309 base::Bind(&DownloadResourceHandler::set_download_id, this, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 " render_view_id_ = " "%d" | 375 " render_view_id_ = " "%d" |
| 376 " save_info_.file_path = \"%" PRFilePath "\"" | 376 " save_info_.file_path = \"%" PRFilePath "\"" |
| 377 " }", | 377 " }", |
| 378 request_->url().spec().c_str(), | 378 request_->url().spec().c_str(), |
| 379 download_id_.local(), | 379 download_id_.local(), |
| 380 global_id_.child_id, | 380 global_id_.child_id, |
| 381 global_id_.request_id, | 381 global_id_.request_id, |
| 382 render_view_id_, | 382 render_view_id_, |
| 383 save_info_.file_path.value().c_str()); | 383 save_info_.file_path.value().c_str()); |
| 384 } | 384 } |
| OLD | NEW |