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 #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/callback.h" | 8 #include "base/callback.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Used for catching use-after-free errors. | 38 // Used for catching use-after-free errors. |
39 void Attach(); | 39 void Attach(); |
40 void Detach(); | 40 void Detach(); |
41 | 41 |
42 // Request determination of the download target from the delegate. | 42 // Request determination of the download target from the delegate. |
43 virtual void DetermineDownloadTarget( | 43 virtual void DetermineDownloadTarget( |
44 DownloadItemImpl* download, const DownloadTargetCallback& callback); | 44 DownloadItemImpl* download, const DownloadTargetCallback& callback); |
45 | 45 |
46 // Allows the delegate to delay completion of the download. This function | 46 // Allows the delegate to delay completion of the download. This function |
47 // will call the callback passed when the download is ready for completion. | 47 // will either return true (if the download may complete now) or will return |
48 // This may be done immediately, from within the routine itself, or it | 48 // false and call the provided callback at some future point. This function |
49 // may be delayed. | 49 // may be called repeatedly. |
50 // This routine should only be called once per download. | 50 virtual bool ShouldCompleteDownload( |
51 virtual void ReadyForDownloadCompletion( | |
52 DownloadItemImpl* download, | 51 DownloadItemImpl* download, |
53 const base::Closure& complete_callback); | 52 const base::Closure& complete_callback); |
54 | 53 |
55 // Allows the delegate to override the opening of a download. If it returns | 54 // Allows the delegate to override the opening of a download. If it returns |
56 // true then it's reponsible for opening the item. | 55 // true then it's reponsible for opening the item. |
57 virtual bool ShouldOpenDownload( | 56 virtual bool ShouldOpenDownload( |
58 DownloadItemImpl* download, const ShouldOpenDownloadCallback& callback); | 57 DownloadItemImpl* download, const ShouldOpenDownloadCallback& callback); |
59 | 58 |
60 // Tests if a file type should be opened automatically. | 59 // Tests if a file type should be opened automatically. |
61 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); | 60 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); |
(...skipping 24 matching lines...) Expand all Loading... |
86 private: | 85 private: |
87 // For "Outlives attached DownloadItemImpl" invariant assertion. | 86 // For "Outlives attached DownloadItemImpl" invariant assertion. |
88 int count_; | 87 int count_; |
89 | 88 |
90 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); | 89 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); |
91 }; | 90 }; |
92 | 91 |
93 } // namespace content | 92 } // namespace content |
94 | 93 |
95 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ | 94 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ |
OLD | NEW |