Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: content/browser/download/download_resource_handler.cc

Issue 14955002: [Resumption 6/11] Add a RESUMING_INTERNAL state to DownloadItem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // NULL in unittests or if the page closed right after starting the 58 // NULL in unittests or if the page closed right after starting the
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 // |item| can be NULL if the download has been removed.
68 if (!started_cb.is_null()) 69 if (!started_cb.is_null())
69 started_cb.Run(item, net::OK); 70 started_cb.Run(item, item ? net::OK : net::ERR_ABORTED);
70 } 71 }
71 72
72 } // namespace 73 } // namespace
73 74
74 const int DownloadResourceHandler::kDownloadByteStreamSize = 100 * 1024; 75 const int DownloadResourceHandler::kDownloadByteStreamSize = 100 * 1024;
75 76
76 DownloadResourceHandler::DownloadResourceHandler( 77 DownloadResourceHandler::DownloadResourceHandler(
77 DownloadId id, 78 DownloadId id,
78 net::URLRequest* request, 79 net::URLRequest* request,
79 const DownloadResourceHandler::OnStartedCallback& started_cb, 80 const DownloadResourceHandler::OnStartedCallback& started_cb,
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 482
482 // Remove output stream callback if a stream exists. 483 // Remove output stream callback if a stream exists.
483 if (stream_writer_) 484 if (stream_writer_)
484 stream_writer_->RegisterCallback(base::Closure()); 485 stream_writer_->RegisterCallback(base::Closure());
485 486
486 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", 487 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration",
487 base::TimeTicks::Now() - download_start_time_); 488 base::TimeTicks::Now() - download_start_time_);
488 } 489 }
489 490
490 } // namespace content 491 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698