| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 profile in Chrome. | 8 // active profile in Chrome. |
| 9 // | 9 // |
| 10 // Download observers: | 10 // Download observers: |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 // Remove downloads will delete all downloads that have a timestamp that is | 129 // Remove downloads will delete all downloads that have a timestamp that is |
| 130 // the same or more recent than |remove_begin|. The number of downloads | 130 // the same or more recent than |remove_begin|. The number of downloads |
| 131 // deleted is returned back to the caller. | 131 // deleted is returned back to the caller. |
| 132 int RemoveDownloads(const base::Time remove_begin); | 132 int RemoveDownloads(const base::Time remove_begin); |
| 133 | 133 |
| 134 // Remove all downloads will delete all downloads. The number of downloads | 134 // Remove all downloads will delete all downloads. The number of downloads |
| 135 // deleted is returned back to the caller. | 135 // deleted is returned back to the caller. |
| 136 int RemoveAllDownloads(); | 136 int RemoveAllDownloads(); |
| 137 | 137 |
| 138 // Called when a Save Page As download is started. |
| 139 void SavePageAsDownloadStarted(DownloadItem* download_item); |
| 140 |
| 138 // Download the object at the URL. Used in cases such as "Save Link As..." | 141 // Download the object at the URL. Used in cases such as "Save Link As..." |
| 139 void DownloadUrl(const GURL& url, | 142 void DownloadUrl(const GURL& url, |
| 140 const GURL& referrer, | 143 const GURL& referrer, |
| 141 const std::string& referrer_encoding, | 144 const std::string& referrer_encoding, |
| 142 TabContents* tab_contents); | 145 TabContents* tab_contents); |
| 143 | 146 |
| 144 // Download the object at the URL and save it to the specified path. The | 147 // Download the object at the URL and save it to the specified path. The |
| 145 // download is treated as the temporary download and thus will not appear | 148 // download is treated as the temporary download and thus will not appear |
| 146 // in the download history. Used in cases such as drag and drop. | 149 // in the download history. Used in cases such as drag and drop. |
| 147 void DownloadUrlToFile(const GURL& url, | 150 void DownloadUrlToFile(const GURL& url, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // handle, the DownloadItem* is placed in the 'downloads_' map. When the | 303 // handle, the DownloadItem* is placed in the 'downloads_' map. When the |
| 301 // download is complete, it is removed from 'in_progress_'. Downloads from | 304 // download is complete, it is removed from 'in_progress_'. Downloads from |
| 302 // past sessions read from a persisted state from the history system are | 305 // past sessions read from a persisted state from the history system are |
| 303 // placed directly into 'downloads_' since they have valid handles in the | 306 // placed directly into 'downloads_' since they have valid handles in the |
| 304 // history system. | 307 // history system. |
| 305 typedef base::hash_map<int64, DownloadItem*> DownloadMap; | 308 typedef base::hash_map<int64, DownloadItem*> DownloadMap; |
| 306 DownloadMap downloads_; | 309 DownloadMap downloads_; |
| 307 DownloadMap in_progress_; | 310 DownloadMap in_progress_; |
| 308 DownloadMap dangerous_finished_; | 311 DownloadMap dangerous_finished_; |
| 309 | 312 |
| 313 // Collection of all save-page-as downloads in this profile. |
| 314 // It owns the DownloadItems. |
| 315 std::vector<DownloadItem*> save_page_downloads_; |
| 316 |
| 310 // True if the download manager has been initialized and requires a shutdown. | 317 // True if the download manager has been initialized and requires a shutdown. |
| 311 bool shutdown_needed_; | 318 bool shutdown_needed_; |
| 312 | 319 |
| 313 // Observers that want to be notified of changes to the set of downloads. | 320 // Observers that want to be notified of changes to the set of downloads. |
| 314 ObserverList<Observer> observers_; | 321 ObserverList<Observer> observers_; |
| 315 | 322 |
| 316 // The current active profile. | 323 // The current active profile. |
| 317 Profile* profile_; | 324 Profile* profile_; |
| 318 scoped_refptr<URLRequestContextGetter> request_context_getter_; | 325 scoped_refptr<URLRequestContextGetter> request_context_getter_; |
| 319 | 326 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 339 // The "Save As" dialog box used to ask the user where a file should be | 346 // The "Save As" dialog box used to ask the user where a file should be |
| 340 // saved. | 347 // saved. |
| 341 scoped_refptr<SelectFileDialog> select_file_dialog_; | 348 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 342 | 349 |
| 343 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 350 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
| 344 | 351 |
| 345 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 352 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
| 346 }; | 353 }; |
| 347 | 354 |
| 348 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 355 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |