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_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // | 70 // |
71 // The state of the |item| shouldn't be modified during the process of | 71 // The state of the |item| shouldn't be modified during the process of |
72 // filename determination save for external data (GetExternalData() / | 72 // filename determination save for external data (GetExternalData() / |
73 // SetExternalData()). | 73 // SetExternalData()). |
74 // | 74 // |
75 // If the download should be canceled, |callback| should be invoked with an | 75 // If the download should be canceled, |callback| should be invoked with an |
76 // empty |target_path| argument. | 76 // empty |target_path| argument. |
77 virtual bool DetermineDownloadTarget(DownloadItem* item, | 77 virtual bool DetermineDownloadTarget(DownloadItem* item, |
78 const DownloadTargetCallback& callback); | 78 const DownloadTargetCallback& callback); |
79 | 79 |
80 // Called when the download system wants to alert a WebContents that a | |
81 // download has started, but the TabConetnts has gone away. This lets an | |
82 // delegate return an alternative WebContents. The delegate can return NULL. | |
83 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload(); | |
84 | |
85 // Tests if a file type should be opened automatically. | 80 // Tests if a file type should be opened automatically. |
86 virtual bool ShouldOpenFileBasedOnExtension(const base::FilePath& path); | 81 virtual bool ShouldOpenFileBasedOnExtension(const base::FilePath& path); |
87 | 82 |
88 // Allows the delegate to delay completion of the download. This function | 83 // Allows the delegate to delay completion of the download. This function |
89 // will either return true (in which case the download may complete) | 84 // will either return true (in which case the download may complete) |
90 // or will call the callback passed when the download is ready for | 85 // or will call the callback passed when the download is ready for |
91 // completion. This routine may be called multiple times; once the callback | 86 // completion. This routine may be called multiple times; once the callback |
92 // has been called or the function has returned true for a particular | 87 // has been called or the function has returned true for a particular |
93 // download it should continue to return true for that download. | 88 // download it should continue to return true for that download. |
94 virtual bool ShouldCompleteDownload( | 89 virtual bool ShouldCompleteDownload( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 DownloadItem* download, | 127 DownloadItem* download, |
133 const CheckForFileExistenceCallback& callback) {} | 128 const CheckForFileExistenceCallback& callback) {} |
134 | 129 |
135 protected: | 130 protected: |
136 virtual ~DownloadManagerDelegate(); | 131 virtual ~DownloadManagerDelegate(); |
137 }; | 132 }; |
138 | 133 |
139 } // namespace content | 134 } // namespace content |
140 | 135 |
141 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 136 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |