| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 base::Bind(&CallStartedCBOnUIThread, started_cb_, item, error)); | 215 base::Bind(&CallStartedCBOnUIThread, started_cb_, item, error)); |
| 216 started_cb_.Reset(); | 216 started_cb_.Reset(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 bool DownloadResourceHandler::OnWillStart(int request_id, | 219 bool DownloadResourceHandler::OnWillStart(int request_id, |
| 220 const GURL& url, | 220 const GURL& url, |
| 221 bool* defer) { | 221 bool* defer) { |
| 222 return true; | 222 return true; |
| 223 } | 223 } |
| 224 | 224 |
| 225 bool DownloadResourceHandler::OnBeforeNetworkStart(int request_id, |
| 226 const GURL& url, |
| 227 bool* defer) { |
| 228 return true; |
| 229 } |
| 230 |
| 225 // Create a new buffer, which will be handed to the download thread for file | 231 // Create a new buffer, which will be handed to the download thread for file |
| 226 // writing and deletion. | 232 // writing and deletion. |
| 227 bool DownloadResourceHandler::OnWillRead(int request_id, | 233 bool DownloadResourceHandler::OnWillRead(int request_id, |
| 228 scoped_refptr<net::IOBuffer>* buf, | 234 scoped_refptr<net::IOBuffer>* buf, |
| 229 int* buf_size, | 235 int* buf_size, |
| 230 int min_size) { | 236 int min_size) { |
| 231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 232 DCHECK(buf && buf_size); | 238 DCHECK(buf && buf_size); |
| 233 DCHECK(!read_buffer_.get()); | 239 DCHECK(!read_buffer_.get()); |
| 234 | 240 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 473 |
| 468 // Remove output stream callback if a stream exists. | 474 // Remove output stream callback if a stream exists. |
| 469 if (stream_writer_) | 475 if (stream_writer_) |
| 470 stream_writer_->RegisterCallback(base::Closure()); | 476 stream_writer_->RegisterCallback(base::Closure()); |
| 471 | 477 |
| 472 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", | 478 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", |
| 473 base::TimeTicks::Now() - download_start_time_); | 479 base::TimeTicks::Now() - download_start_time_); |
| 474 } | 480 } |
| 475 | 481 |
| 476 } // namespace content | 482 } // namespace content |
| OLD | NEW |