Chromium Code Reviews| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 // download. | 59 // download. |
| 60 if (!started_cb.is_null()) | 60 if (!started_cb.is_null()) |
| 61 started_cb.Run(NULL, net::ERR_ACCESS_DENIED); | 61 started_cb.Run(NULL, net::ERR_ACCESS_DENIED); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 | 64 |
| 65 DownloadItem* item = download_manager->StartDownload( | 65 DownloadItem* item = download_manager->StartDownload( |
| 66 info.Pass(), stream.Pass()); | 66 info.Pass(), stream.Pass()); |
| 67 | 67 |
| 68 if (!started_cb.is_null()) | 68 if (!started_cb.is_null()) |
| 69 started_cb.Run(item, net::OK); | 69 started_cb.Run(item, item ? net::OK : net::ERR_FAILED); |
|
benjhayden
2013/05/11 17:10:09
Could item be NULL for any reason other than the R
asanka
2013/05/13 19:19:01
Done.
| |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 const int DownloadResourceHandler::kDownloadByteStreamSize = 100 * 1024; | 74 const int DownloadResourceHandler::kDownloadByteStreamSize = 100 * 1024; |
| 75 | 75 |
| 76 DownloadResourceHandler::DownloadResourceHandler( | 76 DownloadResourceHandler::DownloadResourceHandler( |
| 77 DownloadId id, | 77 DownloadId id, |
| 78 net::URLRequest* request, | 78 net::URLRequest* request, |
| 79 const DownloadResourceHandler::OnStartedCallback& started_cb, | 79 const DownloadResourceHandler::OnStartedCallback& started_cb, |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 | 481 |
| 482 // Remove output stream callback if a stream exists. | 482 // Remove output stream callback if a stream exists. |
| 483 if (stream_writer_) | 483 if (stream_writer_) |
| 484 stream_writer_->RegisterCallback(base::Closure()); | 484 stream_writer_->RegisterCallback(base::Closure()); |
| 485 | 485 |
| 486 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", | 486 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", |
| 487 base::TimeTicks::Now() - download_start_time_); | 487 base::TimeTicks::Now() - download_start_time_); |
| 488 } | 488 } |
| 489 | 489 |
| 490 } // namespace content | 490 } // namespace content |
| OLD | NEW |