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_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // the DownloadManager are maps; they do not own the DownloadItems. | 203 // the DownloadManager are maps; they do not own the DownloadItems. |
204 // Note that this is the only place (with any functional implications; | 204 // Note that this is the only place (with any functional implications; |
205 // see save_page_downloads_ below) that "save page as" downloads are | 205 // see save_page_downloads_ below) that "save page as" downloads are |
206 // kept, as the DownloadManager's only job is to hold onto those | 206 // kept, as the DownloadManager's only job is to hold onto those |
207 // until destruction. | 207 // until destruction. |
208 // | 208 // |
209 // |active_downloads_| is a map of all downloads that are currently being | 209 // |active_downloads_| is a map of all downloads that are currently being |
210 // processed. The key is the ID assigned by the DownloadFileManager, | 210 // processed. The key is the ID assigned by the DownloadFileManager, |
211 // which is unique for the current session. | 211 // which is unique for the current session. |
212 // | 212 // |
213 // |save_page_downloads_| (if defined) is a collection of all the | |
214 // downloads the "save page as" system has given to us to hold onto | |
215 // until we are destroyed. They key is DownloadFileManager, so it is unique | |
216 // compared to download item. It is only used for debugging. | |
217 // | |
218 // When a download is created through a user action, the corresponding | 213 // When a download is created through a user action, the corresponding |
219 // DownloadItem* is placed in |active_downloads_| and remains there until the | 214 // DownloadItem* is placed in |active_downloads_| and remains there until the |
220 // download is in a terminal state (COMPLETE or CANCELLED). Once it has a | 215 // download is in a terminal state (COMPLETE or CANCELLED). Once it has a |
221 // valid handle, the DownloadItem* is placed in the |history_downloads_| map. | 216 // valid handle, the DownloadItem* is placed in the |history_downloads_| map. |
222 // Downloads from past sessions read from a persisted state from the history | 217 // Downloads from past sessions read from a persisted state from the history |
223 // system are placed directly into |history_downloads_| since they have valid | 218 // system are placed directly into |history_downloads_| since they have valid |
224 // handles in the history system. | 219 // handles in the history system. |
225 | 220 |
226 DownloadMap downloads_; | 221 DownloadMap downloads_; |
227 DownloadMap active_downloads_; | 222 DownloadMap active_downloads_; |
228 DownloadMap save_page_downloads_; | |
229 | 223 |
230 int history_size_; | 224 int history_size_; |
231 | 225 |
232 // True if the download manager has been initialized and requires a shutdown. | 226 // True if the download manager has been initialized and requires a shutdown. |
233 bool shutdown_needed_; | 227 bool shutdown_needed_; |
234 | 228 |
235 // Observers that want to be notified of changes to the set of downloads. | 229 // Observers that want to be notified of changes to the set of downloads. |
236 ObserverList<Observer> observers_; | 230 ObserverList<Observer> observers_; |
237 | 231 |
238 // The current active browser context. | 232 // The current active browser context. |
239 content::BrowserContext* browser_context_; | 233 content::BrowserContext* browser_context_; |
240 | 234 |
241 // Non-owning pointer for handling file writing on the download_thread_. | 235 // Non-owning pointer for handling file writing on the download_thread_. |
242 DownloadFileManager* file_manager_; | 236 DownloadFileManager* file_manager_; |
243 | 237 |
244 // The user's last choice for download directory. This is only used when the | 238 // The user's last choice for download directory. This is only used when the |
245 // user wants us to prompt for a save location for each download. | 239 // user wants us to prompt for a save location for each download. |
246 FilePath last_download_path_; | 240 FilePath last_download_path_; |
247 | 241 |
248 // Allows an embedder to control behavior. Guaranteed to outlive this object. | 242 // Allows an embedder to control behavior. Guaranteed to outlive this object. |
249 content::DownloadManagerDelegate* delegate_; | 243 content::DownloadManagerDelegate* delegate_; |
250 | 244 |
251 net::NetLog* net_log_; | 245 net::NetLog* net_log_; |
252 | 246 |
253 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 247 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
254 }; | 248 }; |
255 | 249 |
256 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 250 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |