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 // The DownloadManager object manages the process of downloading, including | 5 // The DownloadManager object manages the process of downloading, including |
6 // updates to the history system and providing the information for displaying | 6 // updates to the history system and providing the information for displaying |
7 // the downloads view in the Destinations tab. There is one DownloadManager per | 7 // the downloads view in the Destinations tab. There is one DownloadManager per |
8 // active browser context in Chrome. | 8 // active browser context in Chrome. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 class CONTENT_EXPORT Observer { | 80 class CONTENT_EXPORT Observer { |
81 public: | 81 public: |
82 // New or deleted download, observers should query us for the current set | 82 // New or deleted download, observers should query us for the current set |
83 // of downloads. | 83 // of downloads. |
84 virtual void ModelChanged(DownloadManager* manager) = 0; | 84 virtual void ModelChanged(DownloadManager* manager) = 0; |
85 | 85 |
86 // Called when the DownloadManager is being destroyed to prevent Observers | 86 // Called when the DownloadManager is being destroyed to prevent Observers |
87 // from calling back to a stale pointer. | 87 // from calling back to a stale pointer. |
88 virtual void ManagerGoingDown(DownloadManager* manager) {} | 88 virtual void ManagerGoingDown(DownloadManager* manager) {} |
89 | 89 |
90 // Called immediately after the DownloadManager puts up a select file | |
91 // dialog. | |
92 // |id| indicates which download opened the dialog. | |
93 virtual void SelectFileDialogDisplayed( | |
94 DownloadManager* manager, int32 id) {} | |
95 | |
96 protected: | 90 protected: |
97 virtual ~Observer() {} | 91 virtual ~Observer() {} |
98 }; | 92 }; |
99 | 93 |
100 typedef std::vector<DownloadItem*> DownloadVector; | 94 typedef std::vector<DownloadItem*> DownloadVector; |
101 | 95 |
102 // If |dir_path| is empty, appends all temporary downloads to |*result|. | 96 // If |dir_path| is empty, appends all temporary downloads to |*result|. |
103 // Otherwise, appends all temporary downloads that reside in |dir_path| to | 97 // Otherwise, appends all temporary downloads that reside in |dir_path| to |
104 // |*result|. | 98 // |*result|. |
105 virtual void GetTemporaryDownloads(const FilePath& dir_path, | 99 virtual void GetTemporaryDownloads(const FilePath& dir_path, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // Called by the embedder, in response to | 180 // Called by the embedder, in response to |
187 // DownloadManagerDelegate::AddItemToPersistentStore. | 181 // DownloadManagerDelegate::AddItemToPersistentStore. |
188 virtual void OnItemAddedToPersistentStore(int32 download_id, | 182 virtual void OnItemAddedToPersistentStore(int32 download_id, |
189 int64 db_handle) = 0; | 183 int64 db_handle) = 0; |
190 | 184 |
191 // The number of in progress (including paused) downloads. | 185 // The number of in progress (including paused) downloads. |
192 virtual int InProgressCount() const = 0; | 186 virtual int InProgressCount() const = 0; |
193 | 187 |
194 virtual BrowserContext* GetBrowserContext() const = 0; | 188 virtual BrowserContext* GetBrowserContext() const = 0; |
195 | 189 |
196 virtual FilePath LastDownloadPath() = 0; | |
197 | |
198 // Clears the last download path, used to initialize "save as" dialogs. | |
199 virtual void ClearLastDownloadPath() = 0; | |
200 | |
201 // Called by the delegate after the save as dialog is closed. | |
202 virtual void FileSelected(const FilePath& path, int32 download_id) = 0; | |
203 virtual void FileSelectionCanceled(int32 download_id) = 0; | |
204 | |
205 // Called by the delegate if it delayed the download in | |
206 // DownloadManagerDelegate::ShouldStartDownload and now is ready. | |
207 virtual void RestartDownload(int32 download_id) = 0; | |
208 | |
209 // Checks whether downloaded files still exist. Updates state of downloads | 190 // Checks whether downloaded files still exist. Updates state of downloads |
210 // that refer to removed files. The check runs in the background and may | 191 // that refer to removed files. The check runs in the background and may |
211 // finish asynchronously after this method returns. | 192 // finish asynchronously after this method returns. |
212 virtual void CheckForHistoryFilesRemoval() = 0; | 193 virtual void CheckForHistoryFilesRemoval() = 0; |
213 | 194 |
214 // Get the download item from the history map. Useful after the item has | 195 // Get the download item from the history map. Useful after the item has |
215 // been removed from the active map, or was retrieved from the history DB. | 196 // been removed from the active map, or was retrieved from the history DB. |
216 virtual DownloadItem* GetDownloadItem(int id) = 0; | 197 virtual DownloadItem* GetDownloadItem(int id) = 0; |
217 | 198 |
218 // Get the download item for |id| if present, no matter what type of download | 199 // Get the download item for |id| if present, no matter what type of download |
(...skipping 12 matching lines...) Expand all Loading... |
231 protected: | 212 protected: |
232 virtual ~DownloadManager() {} | 213 virtual ~DownloadManager() {} |
233 | 214 |
234 private: | 215 private: |
235 friend class base::RefCountedThreadSafe<DownloadManager>; | 216 friend class base::RefCountedThreadSafe<DownloadManager>; |
236 }; | 217 }; |
237 | 218 |
238 } // namespace content | 219 } // namespace content |
239 | 220 |
240 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 221 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
OLD | NEW |