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

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

Issue 11740026: Pull delegate check back into IsDownloadReadyForCompletion so that if (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed test. Created 7 years, 11 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
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_manager_impl.h" 5 #include "content/browser/download/download_manager_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (!delegate_ || !delegate_->DetermineDownloadTarget(item, callback)) { 230 if (!delegate_ || !delegate_->DetermineDownloadTarget(item, callback)) {
231 FilePath target_path = item->GetForcedFilePath(); 231 FilePath target_path = item->GetForcedFilePath();
232 // TODO(asanka): Determine a useful path if |target_path| is empty. 232 // TODO(asanka): Determine a useful path if |target_path| is empty.
233 callback.Run(target_path, 233 callback.Run(target_path,
234 DownloadItem::TARGET_DISPOSITION_OVERWRITE, 234 DownloadItem::TARGET_DISPOSITION_OVERWRITE,
235 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, 235 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
236 target_path); 236 target_path);
237 } 237 }
238 } 238 }
239 239
240 void DownloadManagerImpl::ReadyForDownloadCompletion( 240 bool DownloadManagerImpl::ShouldCompleteDownload(
241 DownloadItemImpl* item, const base::Closure& complete_callback) { 241 DownloadItemImpl* item, const base::Closure& complete_callback) {
242 if (!delegate_ || 242 if (!delegate_ ||
243 delegate_->ShouldCompleteDownload(item, complete_callback)) { 243 delegate_->ShouldCompleteDownload(item, complete_callback)) {
244 complete_callback.Run(); 244 return true;
245 } 245 }
246 // Otherwise, the delegate has accepted responsibility to run the 246 // Otherwise, the delegate has accepted responsibility to run the
247 // callback when the download is ready for completion. 247 // callback when the download is ready for completion.
248 return false;
248 } 249 }
249 250
250 bool DownloadManagerImpl::ShouldOpenFileBasedOnExtension(const FilePath& path) { 251 bool DownloadManagerImpl::ShouldOpenFileBasedOnExtension(const FilePath& path) {
251 if (!delegate_) 252 if (!delegate_)
252 return false; 253 return false;
253 254
254 return delegate_->ShouldOpenFileBasedOnExtension(path); 255 return delegate_->ShouldOpenFileBasedOnExtension(path);
255 } 256 }
256 257
257 bool DownloadManagerImpl::ShouldOpenDownload( 258 bool DownloadManagerImpl::ShouldOpenDownload(
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 it != downloads_.end(); ++it) { 628 it != downloads_.end(); ++it) {
628 DownloadItemImpl* item = it->second; 629 DownloadItemImpl* item = it->second;
629 if (item->IsComplete() && 630 if (item->IsComplete() &&
630 !item->GetOpened()) 631 !item->GetOpened())
631 ++num_unopened; 632 ++num_unopened;
632 } 633 }
633 RecordOpensOutstanding(num_unopened); 634 RecordOpensOutstanding(num_unopened);
634 } 635 }
635 636
636 } // namespace content 637 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.h ('k') | content/public/browser/download_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698