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

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

Issue 10799005: Replace the DownloadFileManager with direct ownership (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 8 years, 4 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 10
(...skipping 10 matching lines...) Expand all
21 // be left unimplemented. 21 // be left unimplemented.
22 class CONTENT_EXPORT DownloadItemImplDelegate { 22 class CONTENT_EXPORT DownloadItemImplDelegate {
23 public: 23 public:
24 DownloadItemImplDelegate(); 24 DownloadItemImplDelegate();
25 virtual ~DownloadItemImplDelegate(); 25 virtual ~DownloadItemImplDelegate();
26 26
27 // Used for catching use-after-free errors. 27 // Used for catching use-after-free errors.
28 void Attach(); 28 void Attach();
29 void Detach(); 29 void Detach();
30 30
31 // Tests if a file type should be opened automatically. 31 // Start the delegate's portion of the download; called when the
32 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); 32 // download item is ready for the delegate to take over.
33 // Pure virtual because if the delegate doesn't do something the
34 // DownloadItemImpl is dead in the water.
35 // TODO(rdsmith): The machinery of running the download should be
36 // moved into the DownloadItem, and this should be changed into
37 // a probe as to whether to start and if not, provide a callback
38 // to call when it's time to start.
39 virtual void DelegateStart(DownloadItemImpl* download) = 0;
33 40
34 // Allows the delegate to override the opening of a download. If it returns 41 // Allows the delegate to override the opening of a download. If it returns
35 // true then it's reponsible for opening the item. 42 // true then it's reponsible for opening the item.
36 virtual bool ShouldOpenDownload(DownloadItemImpl* download); 43 virtual bool ShouldOpenDownload(DownloadItemImpl* download);
37 44
45 // Tests if a file type should be opened automatically.
46 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path);
47
38 // Checks whether a downloaded file still exists and updates the 48 // Checks whether a downloaded file still exists and updates the
39 // file's state if the file is already removed. 49 // file's state if the file is already removed.
40 // The check may or may not result in a later asynchronous call 50 // The check may or may not result in a later asynchronous call
41 // to OnDownloadedFileRemoved(). 51 // to OnDownloadedFileRemoved().
42 virtual void CheckForFileRemoval(DownloadItemImpl* download_item); 52 virtual void CheckForFileRemoval(DownloadItemImpl* download_item);
43 53
44 // If all pre-requisites have been met, complete download processing. 54 // If all pre-requisites have been met, complete download processing.
45 // TODO(rdsmith): Move into DownloadItem. 55 // TODO(rdsmith): Move into DownloadItem.
46 virtual void MaybeCompleteDownload(DownloadItemImpl* download); 56 virtual void MaybeCompleteDownload(DownloadItemImpl* download);
47 57
(...skipping 17 matching lines...) Expand all
65 virtual void AssertStateConsistent(DownloadItemImpl* download) const; 75 virtual void AssertStateConsistent(DownloadItemImpl* download) const;
66 76
67 private: 77 private:
68 // For "Outlives attached DownloadItemImpl" invariant assertion. 78 // For "Outlives attached DownloadItemImpl" invariant assertion.
69 int count_; 79 int count_;
70 80
71 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); 81 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate);
72 }; 82 };
73 83
74 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ 84 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_item_impl_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698