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

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

Issue 10912173: Replace the DownloadFileManager with direct ownership of DownloadFileImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR (r159273) Created 8 years, 2 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 "base/logging.h"
6 #include "content/browser/download/download_item_impl_delegate.h" 5 #include "content/browser/download/download_item_impl_delegate.h"
7 6
8 class DownloadItemImpl; 7 #include "base/logging.h"
8 #include "content/browser/download/download_item_impl.h"
9 9
10 // Infrastructure in DownloadItemImplDelegate to assert invariant that 10 // Infrastructure in DownloadItemImplDelegate to assert invariant that
11 // delegate always outlives all attached DownloadItemImpls. 11 // delegate always outlives all attached DownloadItemImpls.
12 DownloadItemImplDelegate::DownloadItemImplDelegate() 12 DownloadItemImplDelegate::DownloadItemImplDelegate()
13 : count_(0) {} 13 : count_(0) {}
14 14
15 DownloadItemImplDelegate::~DownloadItemImplDelegate() { 15 DownloadItemImplDelegate::~DownloadItemImplDelegate() {
16 DCHECK_EQ(0, count_); 16 DCHECK_EQ(0, count_);
17 } 17 }
18 18
19 void DownloadItemImplDelegate::Attach() { 19 void DownloadItemImplDelegate::Attach() {
20 ++count_; 20 ++count_;
21 } 21 }
22 22
23 void DownloadItemImplDelegate::Detach() { 23 void DownloadItemImplDelegate::Detach() {
24 DCHECK_LT(0, count_); 24 DCHECK_LT(0, count_);
25 --count_; 25 --count_;
26 } 26 }
27 27
28 void DownloadItemImplDelegate::DetermineDownloadTarget(
29 DownloadItemImpl* download, DownloadTargetCallback callback) {
asanka 2012/09/28 20:22:42 Why is this a concrete class?
Randy Smith (Not in Mondays) 2012/10/09 20:20:19 As per offline conversation: The chrome/content de
30 // TODO(rdsmith/asanka): Do something useful if forced file path is null.
31 FilePath target_path(download->GetForcedFilePath());
32 callback.Run(target_path,
33 content::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
34 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
35 target_path);
36 }
37
38 bool DownloadItemImplDelegate::ShouldOpenDownload(DownloadItemImpl* download) {
39 return false;
40 }
41
28 bool DownloadItemImplDelegate::ShouldOpenFileBasedOnExtension( 42 bool DownloadItemImplDelegate::ShouldOpenFileBasedOnExtension(
29 const FilePath& path) { 43 const FilePath& path) {
30 return false; 44 return false;
31 } 45 }
32 46
33 bool DownloadItemImplDelegate::ShouldOpenDownload(DownloadItemImpl* download) {
34 return false;
35 }
36
37 void DownloadItemImplDelegate::CheckForFileRemoval( 47 void DownloadItemImplDelegate::CheckForFileRemoval(
38 DownloadItemImpl* download_item) {} 48 DownloadItemImpl* download_item) {}
39 49
40 void DownloadItemImplDelegate::MaybeCompleteDownload( 50 void DownloadItemImplDelegate::MaybeCompleteDownload(
41 DownloadItemImpl* download) {} 51 DownloadItemImpl* download) {}
42 52
43 content::BrowserContext* DownloadItemImplDelegate::GetBrowserContext() const { 53 content::BrowserContext* DownloadItemImplDelegate::GetBrowserContext() const {
44 return NULL; 54 return NULL;
45 } 55 }
46 56
(...skipping 10 matching lines...) Expand all
57 void DownloadItemImplDelegate::DownloadRemoved(DownloadItemImpl* download) {} 67 void DownloadItemImplDelegate::DownloadRemoved(DownloadItemImpl* download) {}
58 68
59 void DownloadItemImplDelegate::DownloadRenamedToIntermediateName( 69 void DownloadItemImplDelegate::DownloadRenamedToIntermediateName(
60 DownloadItemImpl* download) {} 70 DownloadItemImpl* download) {}
61 71
62 void DownloadItemImplDelegate::DownloadRenamedToFinalName( 72 void DownloadItemImplDelegate::DownloadRenamedToFinalName(
63 DownloadItemImpl* download) {} 73 DownloadItemImpl* download) {}
64 74
65 void DownloadItemImplDelegate::AssertStateConsistent( 75 void DownloadItemImplDelegate::AssertStateConsistent(
66 DownloadItemImpl* download) const {} 76 DownloadItemImpl* download) const {}
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl_delegate.h ('k') | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698